Skip to content

Commit e4f1c87

Browse files
authored
Merge pull request rails#50962 from joshuay03/update-has-one-create-test-descriptions
Update some create `has_one` failure test descriptions
2 parents 6314290 + e61234d commit e4f1c87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

activerecord/test/cases/associations/has_one_associations_test.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def test_attributes_are_being_set_when_initialized_from_has_one_association_with
531531
assert_equal "Account", new_account.firm_name
532532
end
533533

534-
def test_create_association_replaces_existing_without_dependent_option
534+
def test_creation_failure_replaces_existing_without_dependent_option
535535
pirate = pirates(:blackbeard)
536536
orig_ship = pirate.ship
537537

@@ -540,16 +540,18 @@ def test_create_association_replaces_existing_without_dependent_option
540540
assert_not_equal ships(:black_pearl), new_ship
541541
assert_equal new_ship, pirate.ship
542542
assert_predicate new_ship, :new_record?
543+
assert_predicate new_ship, :invalid?
543544
assert_nil orig_ship.pirate_id
544545
assert_not orig_ship.changed? # check it was saved
545546
end
546547

547-
def test_create_association_replaces_existing_with_dependent_option
548+
def test_creation_failure_replaces_existing_with_dependent_option
548549
pirate = pirates(:blackbeard).becomes(DestructivePirate)
549550
orig_ship = pirate.dependent_ship
550551

551552
new_ship = pirate.create_dependent_ship
552553
assert_predicate new_ship, :new_record?
554+
assert_predicate new_ship, :invalid?
553555
assert_predicate orig_ship, :destroyed?
554556
end
555557

0 commit comments

Comments
 (0)