diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-18 16:27:50 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-18 16:27:50 -0200 |
commit | a739340d3c9e66814429af6f3f410c01ff86810a (patch) | |
tree | 91cd2f49400bff3c7c4e4fef1e63aababacd0b95 | |
parent | 5e7919cd63fdc09403ed0dcadbc1c18c5f1fa881 (diff) | |
download | rails-a739340d3c9e66814429af6f3f410c01ff86810a.tar.gz rails-a739340d3c9e66814429af6f3f410c01ff86810a.tar.bz2 rails-a739340d3c9e66814429af6f3f410c01ff86810a.zip |
Ensure ordering to make the test pass with postgresql
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 9d2229e733..c34aeaf925 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -157,19 +157,19 @@ class RelationTest < ActiveRecord::TestCase assert_equal 4, topics.to_a.size assert_equal topics(:first).title, topics.first.title end - + def test_finding_with_assoc_order topics = Topic.order(:id => :desc) assert_equal 4, topics.to_a.size assert_equal topics(:fourth).title, topics.first.title end - + def test_finding_with_reverted_assoc_order topics = Topic.order(:id => :asc).reverse_order assert_equal 4, topics.to_a.size assert_equal topics(:fourth).title, topics.first.title end - + def test_raising_exception_on_invalid_hash_params assert_raise(ArgumentError) { Topic.order(:name, "id DESC", :id => :DeSc) } end @@ -1440,7 +1440,8 @@ class RelationTest < ActiveRecord::TestCase end test 'group with select and includes' do - authors_count = Post.select('author_id, COUNT(author_id) AS num_posts').group('author_id').includes(:author).to_a + authors_count = Post.select('author_id, COUNT(author_id) AS num_posts'). + group('author_id').order('author_id').includes(:author).to_a assert_no_queries do result = authors_count.map do |post| |