parent
85c214d552
commit
64c7c1360f
|
@ -173,8 +173,7 @@ end
|
|||
|
||||
Aliases
|
||||
-------
|
||||
|
||||
Aliases allow you to use named associations more easily.
|
||||
FactoryGirl allows you to define aliases to existing factories to make them easier to re-use. This could come in handy when, for example, your Post object has a author attribute that actually refers to an instance of a User class. While normally FactoryGirl can infer the factory name from the association name, in this case it will look for a author factory in vain. So, alias your user factory so it can be used under alias names.
|
||||
|
||||
```ruby
|
||||
factory :user, aliases: [:author, :commenter] do
|
||||
|
|
Loading…
Reference in New Issue