diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-30 12:57:44 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-30 12:57:44 -0200 |
commit | 4f8bdfb40fd464d9bb3760dbac18cb6c6cbb4d4e (patch) | |
tree | 6d9f87ff14f6f0afbeaebf5b3dc4a22992fc0cfd /activerecord/test/cases/finder_test.rb | |
parent | 892658a3d266828bd30d20101cab67de1e889278 (diff) | |
parent | a093afd8ce6d15ea38972141f6000fe3798b6667 (diff) | |
download | rails-4f8bdfb40fd464d9bb3760dbac18cb6c6cbb4d4e.tar.gz rails-4f8bdfb40fd464d9bb3760dbac18cb6c6cbb4d4e.tar.bz2 rails-4f8bdfb40fd464d9bb3760dbac18cb6c6cbb4d4e.zip |
Merge pull request #22447 from kamipo/fix_test_to_null_agnostic_way
Fix `test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct` to NULL-agnostic way
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 9f90ab79a1..75a74c052d 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -19,7 +19,7 @@ require 'models/car' require 'models/tyre' class FinderTest < ActiveRecord::TestCase - fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts, :authors, :customers, :categories, :categorizations, :cars + fixtures :companies, :topics, :entrants, :developers, :developers_projects, :posts, :comments, :accounts, :authors, :author_addresses, :customers, :categories, :categorizations, :cars def test_find_by_id_with_hash assert_raises(ActiveRecord::StatementInvalid) do @@ -993,10 +993,13 @@ class FinderTest < ActiveRecord::TestCase end def test_find_with_order_on_included_associations_with_construct_finder_sql_for_association_limiting_and_is_distinct - assert_equal 2, Post.includes(authors: :author_address).order('author_addresses.id DESC ').limit(2).to_a.size + assert_equal 2, Post.includes(authors: :author_address). + where.not(author_addresses: { id: nil }). + order('author_addresses.id DESC').limit(2).to_a.size assert_equal 3, Post.includes(author: :author_address, authors: :author_address). - order('author_addresses_authors.id DESC ').limit(3).to_a.size + where.not(author_addresses_authors: { id: nil }). + order('author_addresses_authors.id DESC').limit(3).to_a.size end def test_find_with_nil_inside_set_passed_for_one_attribute |