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
This commit is contained in:
commit
4f8bdfb40f
@ -19,7 +19,7 @@
|
||||
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 @@ def test_select_rows
|
||||
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
|
||||
|
@ -3,3 +3,9 @@ david_address:
|
||||
|
||||
david_address_extra:
|
||||
id: 2
|
||||
|
||||
mary_address:
|
||||
id: 3
|
||||
|
||||
bob_address:
|
||||
id: 4
|
||||
|
2
activerecord/test/fixtures/authors.yml
vendored
2
activerecord/test/fixtures/authors.yml
vendored
@ -9,7 +9,9 @@ david:
|
||||
mary:
|
||||
id: 2
|
||||
name: Mary
|
||||
author_address_id: 3
|
||||
|
||||
bob:
|
||||
id: 3
|
||||
name: Bob
|
||||
author_address_id: 4
|
||||
|
Loading…
Reference in New Issue
Block a user