aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
diff options
context:
space:
mode:
authorErnie Miller <ernie@metautonomo.us>2008-08-02 11:47:05 -0400
committerMichael Koziarski <michael@koziarski.com>2008-08-08 15:19:08 +0200
commit7f6e7ba1f7e8735f1c3f30ba125b5432f00d2a70 (patch)
tree6ef0f774359e80d8c20dd4fd244edab61bd00cec /activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
parent06e4eb49eaabde76e38e4f275619fe2df51f1e0a (diff)
downloadrails-7f6e7ba1f7e8735f1c3f30ba125b5432f00d2a70.tar.gz
rails-7f6e7ba1f7e8735f1c3f30ba125b5432f00d2a70.tar.bz2
rails-7f6e7ba1f7e8735f1c3f30ba125b5432f00d2a70.zip
Fixed AssociationCollection#<< resulting in unexpected values in @target when :uniq => true
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
index 1ed0522e53..f71b122ff0 100644
--- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -299,6 +299,17 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
assert_equal 3, projects(:active_record, :reload).developers.size
end
+ def test_uniq_option_prevents_duplicate_push
+ project = projects(:active_record)
+ project.developers << developers(:jamis)
+ project.developers << developers(:david)
+ assert_equal 3, project.developers.size
+
+ project.developers << developers(:david)
+ project.developers << developers(:jamis)
+ assert_equal 3, project.developers.size
+ end
+
def test_deleting
david = Developer.find(1)
active_record = Project.find(1)