aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 1e84f5f92d..4b98cc9daf 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -474,10 +474,17 @@ class RelationTest < ActiveRecord::TestCase
relation = relation.where(:name => david.name)
relation = relation.where(:name => 'Santiago')
relation = relation.where(:id => david.id)
- assert_equal [david], relation.all
+ assert_equal [], relation.all
end
- def test_find_all_with_multiple_ors
+ def test_multi_where_ands_queries
+ relation = Author.unscoped
+ david = authors(:david)
+ sql = relation.where(:name => david.name).where(:name => 'Santiago').to_sql
+ assert_match('AND', sql)
+ end
+
+ def test_find_all_with_multiple_should_use_and
david = authors(:david)
relation = [
{ :name => david.name },
@@ -486,7 +493,7 @@ class RelationTest < ActiveRecord::TestCase
].inject(Author.unscoped) do |memo, param|
memo.where(param)
end
- assert_equal [david], relation.all
+ assert_equal [], relation.all
end
def test_find_all_using_where_with_relation