aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-12-29 03:11:57 -0500
committerGitHub <noreply@github.com>2016-12-29 03:11:57 -0500
commit7ca4b2a76d69d86e1afa92cb0f201f0168815636 (patch)
treeb860fb228b32ec0993aaad15bb517babab3c6b8b /activerecord/test/cases
parent3c90818129e9e295f35c928317c55c111a43d8a9 (diff)
parent9abf606a79729833fd90f624ed580ad85f3ebadc (diff)
downloadrails-7ca4b2a76d69d86e1afa92cb0f201f0168815636.tar.gz
rails-7ca4b2a76d69d86e1afa92cb0f201f0168815636.tar.bz2
rails-7ca4b2a76d69d86e1afa92cb0f201f0168815636.zip
Merge pull request #27490 from kamipo/should_not_update_children_when_parent_creation_with_no_reason
Should not update children when the parent creation with no reason
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/autosave_association_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb
index eb80ae4f7c..6d31b7a091 100644
--- a/activerecord/test/cases/autosave_association_test.rb
+++ b/activerecord/test/cases/autosave_association_test.rb
@@ -1391,6 +1391,14 @@ module AutosaveAssociationOnACollectionAssociationTests
assert_equal "Squawky", parrot.reload.name
end
+ def test_should_not_update_children_when_parent_creation_with_no_reason
+ parrot = Parrot.create!(name: "Polly")
+ assert_equal 0, parrot.updated_count
+
+ Pirate.create!(parrot_ids: [parrot.id], catchphrase: "Arrrr")
+ assert_equal 0, parrot.reload.updated_count
+ end
+
def test_should_automatically_validate_the_associated_models
@pirate.send(@association_name).each { |child| child.name = "" }