aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-26 15:00:54 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-26 15:01:28 -0700
commita384c002af413bcc258122533e70742dfe960fa8 (patch)
tree2541f8338e74a323f33bf27babde2d0aed0372ac /activerecord/test
parent39f2c3b3ea6fac371e79c284494e3d4cfdc1e929 (diff)
downloadrails-a384c002af413bcc258122533e70742dfe960fa8.tar.gz
rails-a384c002af413bcc258122533e70742dfe960fa8.tar.bz2
rails-a384c002af413bcc258122533e70742dfe960fa8.zip
Generate a query that makes sense when testing having clauses
PG expects us to not give it nonsenes [Sean Griffin & anthonynavarre]
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index e0e04a0891..742c14b00e 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -1476,8 +1476,8 @@ class RelationTest < ActiveRecord::TestCase
def test_having_with_binds_for_both_where_and_having
post = Post.first
- having_then_where = Post.having(id: post.id).where(title: post.title).group(:title)
- where_then_having = Post.where(title: post.title).having(id: post.id).group(:title)
+ having_then_where = Post.having(id: post.id).where(title: post.title).group(:id)
+ where_then_having = Post.where(title: post.title).having(id: post.id).group(:id)
assert_equal [post], having_then_where
assert_equal [post], where_then_having
@@ -1485,7 +1485,8 @@ class RelationTest < ActiveRecord::TestCase
def test_multiple_where_and_having_clauses
post = Post.first
- having_then_where = Post.having(id: post.id).where(title: post.title).having(id: post.id).where(title: post.title).group(:title)
+ having_then_where = Post.having(id: post.id).where(title: post.title)
+ .having(id: post.id).where(title: post.title).group(:id)
assert_equal [post], having_then_where
end