Skip to content

Commit

Permalink
More docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Jul 1, 2011
1 parent 4d83729 commit 9e1024b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,32 @@ Most factory attributes can be added using static values that are evaluated when
date_of_birth { 21.years.ago }
end

Aliases
-------

Aliases allow you to use named associations more easily.

factory :user, :aliases => [:author, :commenter] do
first_name "John"
last_name "Doe"
date_of_birth { 18.years.ago }
end

factory :post do
author
# instead of
# association :author, :factory => :user
title "How to read a book effectively"
body "There are five steps involved."
end

factory :comment do
commenter
# instead of
# association :commenter, :factory => :user
body "Great article!"
end

Dependent Attributes
--------------------

Expand Down

0 comments on commit 9e1024b

Please sign in to comment.