diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-20 20:42:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-20 20:42:46 -0300 |
commit | 26931eb32082b3468dc12df59c4041841f64c510 (patch) | |
tree | 72f40802ecc0cf9f2cad45c1b1eb7bc2133cd647 /activerecord/test/cases | |
parent | 5508a3e5ca05d4c43232868f40ebd726d251eeac (diff) | |
download | rails-26931eb32082b3468dc12df59c4041841f64c510.tar.gz rails-26931eb32082b3468dc12df59c4041841f64c510.tar.bz2 rails-26931eb32082b3468dc12df59c4041841f64c510.zip |
Revert "Revert "Merge pull request #8313 from alan/only_save_changed_has_one_objects""
This reverts commit e94e6c27af495a2460c811bb506459f1428dec6b.
Conflicts:
activerecord/CHANGELOG.md
The original commit was reverted only to be safe since #14407 were reported.
We don't have any proof we added a regression with the original commit
so reverting it now will give us more problem.
Closes #14407
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/autosave_association_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index f7584c3a51..09892d50ba 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -683,10 +683,23 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase end end + @ship.pirate.catchphrase = "Changed Catchphrase" + assert_raise(RuntimeError) { assert !@pirate.save } assert_not_nil @pirate.reload.ship end + def test_should_save_changed_has_one_changed_object_if_child_is_saved + @pirate.ship.name = "NewName" + assert @pirate.save + assert_equal "NewName", @pirate.ship.reload.name + end + + def test_should_not_save_changed_has_one_unchanged_object_if_child_is_saved + @pirate.ship.expects(:save).never + assert @pirate.save + end + # belongs_to def test_should_destroy_a_parent_association_as_part_of_the_save_transaction_if_it_was_marked_for_destroyal assert !@ship.pirate.marked_for_destruction? |