Permalink
Browse files

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

…different sorting of same results (on Oracle database)
  • Loading branch information...
1 parent 8f34c96 commit 8afab34a7699abe5c4eed552815276df01510370 @rsim rsim committed Apr 12, 2009
Showing with 2 additions and 1 deletion.
  1. +2 −1 activerecord/test/cases/named_scope_test.rb
@@ -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

0 comments on commit 8afab34

Please sign in to comment.