提交 8afab34a 编写于 作者: R Raimonds Simanovskis

always sort lists by id before comparison to avoid errors because of different...

always sort lists by id before comparison to avoid errors because of different sorting of same results (on Oracle database)
上级 8f34c966
......@@ -154,7 +154,8 @@ def test_named_scopes_honor_current_scopes_from_when_defined
assert !authors(:david).posts.ranked_by_comments.limit(5).empty?
assert_not_equal Post.ranked_by_comments.limit(5), authors(:david).posts.ranked_by_comments.limit(5)
assert_not_equal Post.top(5), authors(:david).posts.top(5)
assert_equal authors(:david).posts.ranked_by_comments.limit(5), authors(:david).posts.top(5)
# Oracle sometimes sorts differently if WHERE condition is changed
assert_equal authors(:david).posts.ranked_by_comments.limit(5).sort_by(&:id), authors(:david).posts.top(5).sort_by(&:id)
assert_equal Post.ranked_by_comments.limit(5), Post.top(5)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册