fix tests that were relying on AR's ridiculous behaviour

This commit is contained in:
Charlie Somerville
2014-04-20 12:53:31 +10:00
parent 92aedbccd3
commit b8178f44a8
2 changed files with 15 additions and 3 deletions

View File

@@ -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

View File

@@ -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