From 13e466c916bd369673ee1fcefc2803b7feac99f1 Mon Sep 17 00:00:00 2001 From: Sam Jewell Date: Mon, 25 Jan 2021 21:40:15 +0000 Subject: [PATCH] Update test names to match their behaviour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests were names `…creation_failure…` but there's no creation failing in the tests themselves. Instead creation is succeeding, via the `create_association` method which is added by the `has_one` relation. I found these test names very confusing when reading this issue: https://github.com/rails/rails/issues/13197 And the commit it links to: c6e10b0 The least we can do to make that issue less confusing is to start by fixing these test names. [ci skip] --- .../test/cases/associations/has_one_associations_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 8796b03eaf536..f3cc97d50f670 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -488,7 +488,7 @@ def test_attributes_are_being_set_when_initialized_from_has_one_association_with assert_equal new_account.firm_name, "Account" end - def test_creation_failure_without_dependent_option + def test_create_association_replaces_existing_without_dependent_option pirate = pirates(:blackbeard) orig_ship = pirate.ship @@ -501,7 +501,7 @@ def test_creation_failure_without_dependent_option assert_not orig_ship.changed? # check it was saved end - def test_creation_failure_with_dependent_option + def test_create_association_replaces_existing_with_dependent_option pirate = pirates(:blackbeard).becomes(DestructivePirate) orig_ship = pirate.dependent_ship