Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# It would be awesome if factory_girl let you specify multiple parent factories.
Factory.define :user do |f|
# normal factory definition ...
end
Factory.define :superuser, :parent => :user do |f|
f.is_superuser true
end
Factory.define :active_user, :parent => :user do |f|
f.is_active true
end
# Hooray, no duplicate factory definitions!
Factory.define :active_superuser, :parents => [:active_user, :superuser] do |f|
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.