Created
April 11, 2011 20:53
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
Lazy Attributes | |
Most factory attributes can be added using static values that are evaluated when the factory is defined, but some attributes (such as associations and other attributes that must be dynamically generated) will need values assigned each time an instance is generated. These "lazy" attributes can be added by passing a block instead of a parameter: | |
Factory.define :user do |u| | |
# ... | |
u.activation_code { User.generate_activation_code } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment