diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-01-18 05:06:42 -0800 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-01-18 05:06:42 -0800 |
commit | 637a7d9d357a0f3f725b0548282ca8c5e7d4af4a (patch) | |
tree | d0b3307df008377ba4b0449866d45c1a66556991 /activerecord/test/cases/autosave_association_test.rb | |
parent | 5937bd02dee112646469848d7fe8a8bfcef5b4c1 (diff) | |
parent | 7baecc48028e2d0cb57936ad10b9102ed129c9f9 (diff) | |
download | rails-637a7d9d357a0f3f725b0548282ca8c5e7d4af4a.tar.gz rails-637a7d9d357a0f3f725b0548282ca8c5e7d4af4a.tar.bz2 rails-637a7d9d357a0f3f725b0548282ca8c5e7d4af4a.zip |
Merge pull request #8989 from robertomiranda/use-rails-4-find-by
Replace deprecated find_by_* with find_by
Diffstat (limited to 'activerecord/test/cases/autosave_association_test.rb')
-rw-r--r-- | activerecord/test/cases/autosave_association_test.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index e5cb4f8f7a..a138b579a3 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -497,7 +497,7 @@ class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCa assert firm.save firm.reload assert_equal 2, firm.clients.length - assert firm.clients.include?(Client.find_by_name("New Client")) + assert firm.clients.include?(Client.find_by(name: "New Client")) end end @@ -591,11 +591,11 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase id = @pirate.ship.id assert @pirate.ship.marked_for_destruction? - assert Ship.find_by_id(id) + assert Ship.find_by(id:id) @pirate.save assert_nil @pirate.reload.ship - assert_nil Ship.find_by_id(id) + assert_nil Ship.find_by(id: id) end def test_should_skip_validation_on_a_child_association_if_marked_for_destruction @@ -638,11 +638,11 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase id = @ship.pirate.id assert @ship.pirate.marked_for_destruction? - assert Pirate.find_by_id(id) + assert Pirate.find_by(id: id) @ship.save assert_nil @ship.reload.pirate - assert_nil Pirate.find_by_id(id) + assert_nil Pirate.find_by(id:id) end def test_should_skip_validation_on_a_parent_association_if_marked_for_destruction @@ -698,11 +698,11 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase ids = @pirate.birds.map(&:id) assert @pirate.birds.all? { |child| child.marked_for_destruction? } - ids.each { |id| assert klass.find_by_id(id) } + ids.each { |id| assert klass.find_by(id: id) } @pirate.save assert @pirate.reload.birds.empty? - ids.each { |id| assert_nil klass.find_by_id(id) } + ids.each { |id| assert_nil klass.find_by(id: id) } end def test_should_skip_validation_on_has_many_if_marked_for_destruction |