Created
October 14, 2017 16:58
-
-
Save Epigene/281ac2fdb091951dc234cfaecb451a00 to your computer and use it in GitHub Desktop.
Build VS create
This file contains hidden or 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
describe "FactoryGirl.build VS FactoryGirl.create" do | |
subject { book.save! } | |
bout4_number_of = 200 | |
context "when setting up with FactoryGirl.build" do | |
let(:book) { build(:book) } | |
bout4_number_of.times do | |
it "triggers ApplicationRecord.class in callback" do | |
expect(ApplicationRecord).to receive(:class).at_least(:once) | |
subject | |
end | |
end | |
end | |
context "when setting up with FactoryGirl.create" do | |
let(:book) { create(:book) } | |
bout4_number_of.times do | |
it "triggers ApplicationRecord.class in callback" do | |
expect(ApplicationRecord).to receive(:class).at_least(:once) | |
subject | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment