modified rspec tests for refactored code