Skip to content

Commit

Permalink
Partly revert #31819
Browse files Browse the repository at this point in the history
The PR#31819 changed `#preloaders_on` and added some test,
then #33938 reverted changes that were added to the method in #31819.
Since changes in the method were reverted and as mentioned in the
comment #31819 (comment)
that titles of the tests added in #31819 don't reflect implementation I
think we can remove those test for now.
  • Loading branch information
bogdanvlviv committed Oct 25, 2018
1 parent 3f8b135 commit bf6dc7a
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions activerecord/test/cases/associations/eager_test.rb
Expand Up @@ -1618,32 +1618,6 @@ def test_preloading_has_many_through_with_custom_scope
end
end

# Associations::Preloader#preloaders_on works with hash-like objects
test "preloading works with an object that responds to :to_hash" do
CustomHash = Class.new(Hash)

assert_nothing_raised do
Post.preload(CustomHash.new(comments: [{ author: :essays }])).first
end
end

# Associations::Preloader#preloaders_on works with string-like objects
test "preloading works with an object that responds to :to_str" do
CustomString = Class.new(String)

assert_nothing_raised do
Post.preload(CustomString.new("comments")).first
end
end

# Associations::Preloader#preloaders_on does not work with ranges
test "preloading fails when Range is passed" do
exception = assert_raises(ArgumentError) do
Post.preload(1..10).first
end
assert_equal("1..10 was not recognized for preload", exception.message)
end

private
def find_all_ordered(klass, include = nil)
klass.order("#{klass.table_name}.#{klass.primary_key}").includes(include).to_a
Expand Down

0 comments on commit bf6dc7a

Please sign in to comment.