mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Update GETTING_STARTED.md
-clearer docs!
This commit is contained in:
parent
85c214d552
commit
64c7c1360f
1 changed files with 1 additions and 2 deletions
|
@ -173,8 +173,7 @@ end
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
|
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.
|
||||||
Aliases allow you to use named associations more easily.
|
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
factory :user, aliases: [:author, :commenter] do
|
factory :user, aliases: [:author, :commenter] do
|
||||||
|
|
Loading…
Reference in a new issue