aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorMarcelo Giorgi <marklazz.uy@gmail.com>2010-09-30 14:56:11 -0300
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-30 12:13:52 -0700
commitef6df93a8ddb675f1298973bb347825c554e95f9 (patch)
tree2d2f9ac60ae8f3d07fa330f094bf66f0f40272dc /activerecord/test/cases/associations/has_many_associations_test.rb
parent505b532605bd3b9b8a444be10911f0864f1d42ba (diff)
downloadrails-ef6df93a8ddb675f1298973bb347825c554e95f9.tar.gz
rails-ef6df93a8ddb675f1298973bb347825c554e95f9.tar.bz2
rails-ef6df93a8ddb675f1298973bb347825c554e95f9.zip
AssociationCollection#include? working properly for objects added with build method [#3472 state:resolved]
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 720b7fc386..c9f00fd737 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1267,4 +1267,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal new_comment.type, "SpecialComment"
assert_equal new_comment.post_id, posts(:welcome).id
end
+
+ def test_include_method_in_has_many_association_should_return_true_for_instance_added_with_build
+ post = Post.new
+ comment = post.comments.build
+ assert post.comments.include?(comment)
+ end
end