Refactored rspec tests using before(:each)