Created
May 20, 2009 22:26
-
-
Save kylefox/115124 to your computer and use it in GitHub Desktop.
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
# 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