Refactor rspec tests