Skip to content

Instantly share code, notes, and snippets.

@german
Forked from jordanmaguire/rspec_attributes.rb
Created July 30, 2012 09:49
Show Gist options
  • Save german/3205916 to your computer and use it in GitHub Desktop.
Save german/3205916 to your computer and use it in GitHub Desktop.
This is a helpful RSpec pattern I've been playing with lately with great success
let(:vehicle) { FactoryGirl.create(:vehicle, vehicle_attributes) }
let(:vehicle_attributes) { {} }
describe "#to_s"
subject { vehicle.to_s }
let(:vehicle_attributes) { {name: "Carzilla"} }
it { should == "Carzilla" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment