未验证 提交 0fac4559 编写于 作者: M Marla Brizel Zeschin 提交者: GitHub

Update ActiveRecord::OrTest#test_or_when_grouping (#38978)

Co-authored-by: NRyuta Kamizono <kamipo@gmail.com>
上级 2c03e17d
......@@ -95,9 +95,9 @@ def test_or_with_incompatible_unscope
end
def test_or_when_grouping
groups = Post.where("id < 10").group("body").select("body, COUNT(*) AS c")
expected = groups.having("COUNT(*) > 1 OR body like 'Such%'").to_a.map { |o| [o.body, o.c] }
assert_equal expected, groups.having("COUNT(*) > 1").or(groups.having("body like 'Such%'")).to_a.map { |o| [o.body, o.c] }
groups = Post.where("id < 10").group("body")
expected = groups.having("COUNT(*) > 1 OR body like 'Such%'").count
assert_equal expected, groups.having("COUNT(*) > 1").or(groups.having("body like 'Such%'")).count
end
def test_or_with_named_scope
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册