mirror of
https://github.com/github/rails.git
synced 2026-01-08 22:27:59 -05:00
fix tests that were relying on AR's ridiculous behaviour
This commit is contained in:
@@ -981,10 +981,16 @@ class EagerAssociationTest < ActiveRecord::TestCase
|
||||
LazyReader.create! :person => people(:susan), :post => post
|
||||
|
||||
assert_equal 1, post.lazy_readers.to_a.size
|
||||
assert_equal 2, post.lazy_readers_skimmers_or_not.to_a.size
|
||||
|
||||
# This test relied on some completely broken and incorrect behaviour in
|
||||
# ActiveRecord that we've fixed.
|
||||
#
|
||||
# assert_equal 2, post.lazy_readers_skimmers_or_not.to_a.size
|
||||
|
||||
assert_equal 1, post.lazy_readers_skimmers_or_not.to_a.size
|
||||
|
||||
post_with_readers = Post.includes(:lazy_readers_skimmers_or_not).find(post.id)
|
||||
assert_equal 2, post_with_readers.lazy_readers_skimmers_or_not.to_a.size
|
||||
assert_equal 1, post_with_readers.lazy_readers_skimmers_or_not.to_a.size
|
||||
end
|
||||
|
||||
def test_include_has_many_using_primary_key
|
||||
|
||||
@@ -278,7 +278,13 @@ class HasManyScopingTest< ActiveRecord::TestCase
|
||||
|
||||
def test_should_default_scope_on_associations_is_overriden_by_association_conditions
|
||||
reference = references(:michael_unicyclist).becomes(BadReference)
|
||||
assert_equal [reference], people(:michael).fixed_bad_references
|
||||
|
||||
# This test relied on some completely broken and incorrect behaviour in
|
||||
# ActiveRecord that we've fixed.
|
||||
#
|
||||
# assert_equal [reference], people(:michael).fixed_bad_references
|
||||
|
||||
assert_equal [], people(:michael).fixed_bad_references
|
||||
end
|
||||
|
||||
def test_should_maintain_default_scope_on_eager_loaded_associations
|
||||
|
||||
Reference in New Issue
Block a user