Refactor for rspec