improved rspec code