The Factory Girl introduction delineates the difference between FactoryGirl.build()
and FactoryGirl.create()
:
# Returns a User instance that's not saved
user = FactoryGirl.build(:user)
# Returns a saved User instance
user = FactoryGirl.create(:user)
I still don't understand the practical differences between the two. Can someone give an example where you would want to use one and not the other? Thanks!