refactored rspec tests