Created
April 8, 2013 05:37
-
-
Save alex-zige/5334449 to your computer and use it in GitHub Desktop.
Rspec expect -> change syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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