Reputation: 31
Is there a way to access values that are passed into the create method inside a factory definition?
For example
create(:user, name: "Jon")
Is there a way to check in the after(:create) hook if a name was passed or if it is default one?
Upvotes: 0
Views: 394
Reputation: 17647
You can just compare the attributes, like:
user.name == FactoryBot.attributes_for(:user)[:name]
Upvotes: 2