diff options
author | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2009-04-12 20:11:40 +0300 |
---|---|---|
committer | Raimonds Simanovskis <raimonds.simanovskis@gmail.com> | 2009-08-06 23:41:00 +0300 |
commit | 8afab34a7699abe5c4eed552815276df01510370 (patch) | |
tree | 96c2e87494b27e95da31db0fbdbf2ae5cf4e170a /activerecord/test | |
parent | 8f34c966141bbbd0bd8da83e8ce7d8fa322bcc91 (diff) | |
download | rails-8afab34a7699abe5c4eed552815276df01510370.tar.gz rails-8afab34a7699abe5c4eed552815276df01510370.tar.bz2 rails-8afab34a7699abe5c4eed552815276df01510370.zip |
always sort lists by id before comparison to avoid errors because of different sorting of same results (on Oracle database)
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/named_scope_test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb index f4fdc9a39d..2a729f0678 100644 --- a/activerecord/test/cases/named_scope_test.rb +++ b/activerecord/test/cases/named_scope_test.rb @@ -154,7 +154,8 @@ class NamedScopeTest < ActiveRecord::TestCase 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 |