Created
August 29, 2009 00:22
-
-
Save lifo/177340 to your computer and use it in GitHub Desktop.
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
class User | |
has_many :items | |
end | |
class Items | |
belongs_to :user | |
validates_presence_of :user_id | |
end | |
Factory.define(:user) do |u| | |
u.name "foo" | |
end | |
Factory.define(:user_with_items, :parent => :user) do |u| | |
u.items {|items| [items.association(:item), items.association(:item)]} | |
end | |
Factory.define(:item) do |i| | |
i.color "red" | |
end | |
Factory.define(:item_with_user, :parent => :user) do |i| | |
i.association(:user) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment