Skip to content

Instantly share code, notes, and snippets.

@alex-zige
Created April 8, 2013 05:37
Show Gist options
  • Save alex-zige/5334449 to your computer and use it in GitHub Desktop.
Save alex-zige/5334449 to your computer and use it in GitHub Desktop.
Rspec expect -> change syntax
context "when created" do
it "tracked into activities " do
expect{FactoryGirl.create(:drink_report)}.to change(Activity.count).by(1)
end
end
error : Failure/Error: expect{FactoryGirl.create(:drink_report)}.to change(Activity.count).by(1)
TypeError:
nil is not a symbol
should change () => {} on the assertion
context "when created" do
it "tracked into activities " do
expect{FactoryGirl.create(:drink_report)}.to change{Activity.count)}.by(1)
end
end
or another correct way.
context "when created" do
it "tracked into activities " do
expect{FactoryGirl.create(:drink_report)}.to change{Activity.count)}.by(1)
end
end
context "when created" do
it "tracked into activities " do
expect{FactoryGirl.create(:drink_report)}.to change(Activity, :count).by(1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment