From 7baecc48028e2d0cb57936ad10b9102ed129c9f9 Mon Sep 17 00:00:00 2001 From: robertomiranda Date: Fri, 18 Jan 2013 07:56:05 -0500 Subject: User Rails 4 find_by --- activerecord/test/cases/fixtures_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/test/cases/fixtures_test.rb') diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index b0b29f5f42..58f9f7e3b9 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -66,7 +66,7 @@ class FixturesTest < ActiveRecord::TestCase def test_create_fixtures fixtures = ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT, "parrots") - assert Parrot.find_by_name('Curious George'), 'George is not in the database' + assert Parrot.find_by(name: 'Curious George'), 'George is not in the database' assert fixtures.detect { |f| f.name == 'parrots' }, "no fixtures named 'parrots' in #{fixtures.map(&:name).inspect}" end @@ -80,7 +80,7 @@ class FixturesTest < ActiveRecord::TestCase def test_create_symbol_fixtures fixtures = ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT, :collections, :collections => Course) { Course.connection } - assert Course.find_by_name('Collection'), 'course is not in the database' + assert Course.find_by(name: 'Collection'), 'course is not in the database' assert fixtures.detect { |f| f.name == 'collections' }, "no fixtures named 'collections' in #{fixtures.map(&:name).inspect}" end @@ -738,7 +738,7 @@ class ActiveSupportSubclassWithFixturesTest < ActiveRecord::TestCase # This seemingly useless assertion catches a bug that caused the fixtures # setup code call nil[] def test_foo - assert_equal parrots(:louis), Parrot.find_by_name("King Louis") + assert_equal parrots(:louis), Parrot.find_by(name: "King Louis") end end -- cgit v1.2.3