Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Test has_many with attributes_for

  • Loading branch information...
commit 50be54564dcb8bd801fa637b852587a947170cfe 1 parent 89d5e94
@joshuaclayton joshuaclayton authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 spec/acceptance/attributes_for_spec.rb
View
6 spec/acceptance/attributes_for_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.