refactor rspec tests