aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-10-26 00:40:52 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2018-10-26 00:48:47 +0300
commitbf6dc7a714df06c17709bfb73fa273bf9e8be1c6 (patch)
tree450ee0418240d711764c9aabd3accf56b908adb7 /activerecord
parent3f8b1353c64825fb665f3ab0c06d3616dc56b6fe (diff)
downloadrails-bf6dc7a714df06c17709bfb73fa273bf9e8be1c6.tar.gz
rails-bf6dc7a714df06c17709bfb73fa273bf9e8be1c6.tar.bz2
rails-bf6dc7a714df06c17709bfb73fa273bf9e8be1c6.zip
Partly revert #31819
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 https://github.com/rails/rails/pull/31819#discussion_r221847481 that titles of the tests added in #31819 don't reflect implementation I think we can remove those test for now.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb26
1 files changed, 0 insertions, 26 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index ed7715c1e2..b37e59038e 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1618,32 +1618,6 @@ class EagerAssociationTest < ActiveRecord::TestCase
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