refactor for rspec 3 support