aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-08-24 04:42:12 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2014-08-25 17:48:13 -0700
commit58c5261efa6ca0134ebfac8a701915d5e36d2c25 (patch)
tree8b19eaea07da99f8d9e70bd49a0d5a0fbe349d7f /activerecord/test/cases/relations_test.rb
parent3041b0b20374ef627b18b0f8abc627ac316d1fd4 (diff)
downloadrails-58c5261efa6ca0134ebfac8a701915d5e36d2c25.tar.gz
rails-58c5261efa6ca0134ebfac8a701915d5e36d2c25.tar.bz2
rails-58c5261efa6ca0134ebfac8a701915d5e36d2c25.zip
Fixed find_by("sql fragment without bindings") on master
* Also duplicated find_by tests from relations_test.rb to finder_test.rb now that we have a completely different implementation on the class (in core.rb with AST caching stuff). * Also removed a (failing) test that used mocks. Now that we have tests for the behavior, there's no point having another test that tests the implementation (that it delegates). Further, what the test was implying is nolonger true with the current implementation, because Class.find_by is a real method now.
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r--activerecord/test/cases/relations_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 88df997a2f..cc6a3888e3 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -1570,7 +1570,7 @@ class RelationTest < ActiveRecord::TestCase
end
test "find_by doesn't have implicit ordering" do
- assert_sql(/^((?!ORDER).)*$/) { Post.find_by(author_id: 2) }
+ assert_sql(/^((?!ORDER).)*$/) { Post.all.find_by(author_id: 2) }
end
test "find_by! with hash conditions returns the first matching record" do
@@ -1586,7 +1586,7 @@ class RelationTest < ActiveRecord::TestCase
end
test "find_by! doesn't have implicit ordering" do
- assert_sql(/^((?!ORDER).)*$/) { Post.find_by!(author_id: 2) }
+ assert_sql(/^((?!ORDER).)*$/) { Post.all.find_by!(author_id: 2) }
end
test "find_by! raises RecordNotFound if the record is missing" do