aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index ef2872e13c..df53118040 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -1397,5 +1397,14 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
assert developer.special_projects.include?(special_project)
assert !developer.special_projects.include?(other_project)
end
-
+
+ def test_update_attributes_after_push_without_duplicate_join_table_rows
+ developer = Developer.new("name" => "Kano")
+ project = SpecialProject.create("name" => "Special Project")
+ assert developer.save
+ developer.projects << project
+ developer.update_attribute("name", "Bruza")
+ assert_equal "1", developer.connection.select_one("SELECT count(*) FROM developers_projects WHERE
+ project_id = #{project.id} AND developer_id = #{developer.id}")["count(*)"]
+ end
end