Last active
December 14, 2015 14:19
-
-
Save daviddavis/5099785 to your computer and use it in GitHub Desktop.
traits in fg
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
| factory :user do | |
| username "partha" | |
| real_name "Partha Aji" | |
| trait :admin do | |
| username "admin" | |
| end | |
| end | |
| FactoryGirl.create(:user) # <User username: partha real_name: Partha Aji> | |
| FactoryGirl.create(:user, :admin) # <User username: admin real_name: Partha Aji> | |
| # Also you can do this: | |
| factory :admin, :traits => [:admin] | |
| FactoryGirl.create(:admin) # <User username: admin real_name: Partha Aji> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment