Skip to content
This repository
Browse code

Test has_many with attributes_for

  • Loading branch information...
commit 50be54564dcb8bd801fa637b852587a947170cfe 1 parent 89d5e94
Joshua Clayton authored April 17, 2012

Showing 1 changed file with 6 additions and 0 deletions. Show diff stats Hide diff stats

  1. 6  spec/acceptance/attributes_for_spec.rb
6  spec/acceptance/attributes_for_spec.rb
@@ -5,22 +5,28 @@
5 5
 
6 6
   before do
7 7
     define_model('User')
  8
+    define_model('Comment')
8 9
 
9 10
     define_model('Post', title:   :string,
10 11
                          body:    :string,
11 12
                          summary: :string,
12 13
                          user_id: :integer) do
13 14
       belongs_to :user
  15
+      has_many :comments
14 16
     end
15 17
 
16 18
     FactoryGirl.define do
17 19
       factory :user
  20
+      factory :comment
18 21
 
19 22
       factory :post do
20 23
         title { "default title" }
21 24
         body { "default body" }
22 25
         summary { title }
23 26
         user
  27
+        comments do |c|
  28
+          [c.association(:comment)]
  29
+        end
24 30
       end
25 31
     end
26 32
   end

0 notes on commit 50be545

Please sign in to comment.
Something went wrong with that request. Please try again.