Refactor Rspec tests