aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dirty_test.rb
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2013-01-18 05:06:42 -0800
committerGuillermo Iguaran <guilleiguaran@gmail.com>2013-01-18 05:06:42 -0800
commit637a7d9d357a0f3f725b0548282ca8c5e7d4af4a (patch)
treed0b3307df008377ba4b0449866d45c1a66556991 /activerecord/test/cases/dirty_test.rb
parent5937bd02dee112646469848d7fe8a8bfcef5b4c1 (diff)
parent7baecc48028e2d0cb57936ad10b9102ed129c9f9 (diff)
downloadrails-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/dirty_test.rb')
-rw-r--r--activerecord/test/cases/dirty_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index b9961a4420..4fdade2d87 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -249,21 +249,21 @@ class DirtyTest < ActiveRecord::TestCase
pirate.save
# check the change from 1 to ''
- pirate = Pirate.find_by_catchphrase("Yarrrr, me hearties")
+ pirate = Pirate.find_by(catchphrase: "Yarrrr, me hearties")
pirate.parrot_id = ''
assert pirate.parrot_id_changed?
assert_equal([1, nil], pirate.parrot_id_change)
pirate.save
# check the change from nil to 0
- pirate = Pirate.find_by_catchphrase("Yarrrr, me hearties")
+ pirate = Pirate.find_by(catchphrase: "Yarrrr, me hearties")
pirate.parrot_id = 0
assert pirate.parrot_id_changed?
assert_equal([nil, 0], pirate.parrot_id_change)
pirate.save
# check the change from 0 to ''
- pirate = Pirate.find_by_catchphrase("Yarrrr, me hearties")
+ pirate = Pirate.find_by(catchphrase: "Yarrrr, me hearties")
pirate.parrot_id = ''
assert pirate.parrot_id_changed?
assert_equal([0, nil], pirate.parrot_id_change)
@@ -494,7 +494,7 @@ class DirtyTest < ActiveRecord::TestCase
pirate.reload
assert_equal Hash.new, pirate.previous_changes
- pirate = Pirate.find_by_catchphrase("arrr")
+ pirate = Pirate.find_by(catchphrase: "arrr")
pirate.catchphrase = "Me Maties!"
pirate.save!
@@ -505,7 +505,7 @@ class DirtyTest < ActiveRecord::TestCase
assert !pirate.previous_changes.key?('parrot_id')
assert !pirate.previous_changes.key?('created_on')
- pirate = Pirate.find_by_catchphrase("Me Maties!")
+ pirate = Pirate.find_by(catchphrase: "Me Maties!")
pirate.catchphrase = "Thar She Blows!"
pirate.save
@@ -516,7 +516,7 @@ class DirtyTest < ActiveRecord::TestCase
assert !pirate.previous_changes.key?('parrot_id')
assert !pirate.previous_changes.key?('created_on')
- pirate = Pirate.find_by_catchphrase("Thar She Blows!")
+ pirate = Pirate.find_by(catchphrase: "Thar She Blows!")
pirate.update(catchphrase: "Ahoy!")
assert_equal 2, pirate.previous_changes.size
@@ -526,7 +526,7 @@ class DirtyTest < ActiveRecord::TestCase
assert !pirate.previous_changes.key?('parrot_id')
assert !pirate.previous_changes.key?('created_on')
- pirate = Pirate.find_by_catchphrase("Ahoy!")
+ pirate = Pirate.find_by_catchphrase(catchphrase: "Ahoy!")
pirate.update_attribute(:catchphrase, "Ninjas suck!")
assert_equal 2, pirate.previous_changes.size