diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-24 23:30:11 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-01-30 11:58:08 +0000 |
commit | 88df88095c82cde53501abe2a44f6c1f66c272b4 (patch) | |
tree | 22b2b27bd4c735b23bcdf10da16d14df4f479072 /activerecord/test/cases | |
parent | 1da1ac159f9391b9a053a0fb0d426499b9edd5b7 (diff) | |
download | rails-88df88095c82cde53501abe2a44f6c1f66c272b4.tar.gz rails-88df88095c82cde53501abe2a44f6c1f66c272b4.tar.bz2 rails-88df88095c82cde53501abe2a44f6c1f66c272b4.zip |
AssociationCollection#to_ary should definitely dup the target! Also changed #replace which was previously incorrect, but the test passed due to the fact that to_a was not duping.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 7 |
1 files changed, 7 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 3bec9c97f4..5904966ee5 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1349,4 +1349,11 @@ class HasManyAssociationsTest < ActiveRecord::TestCase assert_equal reply.id, first.id assert_equal true, first.approved? end + + def test_to_a_should_dup_target + ary = topics(:first).replies.to_a + target = topics(:first).replies.target + + assert_not_equal target.object_id, ary.object_id + end end |