Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test has_many with attributes_for
  • Loading branch information
joshuaclayton committed Apr 17, 2012
1 parent 89d5e94 commit 50be545
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/acceptance/attributes_for_spec.rb
Expand Up @@ -5,22 +5,28 @@

before do
define_model('User')
define_model('Comment')

define_model('Post', title: :string,
body: :string,
summary: :string,
user_id: :integer) do
belongs_to :user
has_many :comments
end

FactoryGirl.define do
factory :user
factory :comment

factory :post do
title { "default title" }
body { "default body" }
summary { title }
user
comments do |c|
[c.association(:comment)]
end
end
end
end
Expand Down

0 comments on commit 50be545

Please sign in to comment.