mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fb6b0a51b3
This removes FallbackFileSystemResolver, LookupContext#with_fallbacks, and LookupContext.fallbacks. These used to exist to support `render file:`, and rendering templates outside of the defined view paths. `render file:` has since been changed to not use template resolution, and to only render absolute paths. These were no longer callable through any public API.
37 lines
1 KiB
Ruby
37 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "active_record_unit"
|
|
|
|
class MultifetchCacheTest < ActiveRecordTestCase
|
|
fixtures :topics, :replies
|
|
|
|
def setup
|
|
view_paths = ActionController::Base.view_paths
|
|
view_paths.each(&:clear_cache)
|
|
|
|
@view = Class.new(ActionView::Base.with_empty_template_cache) do
|
|
def view_cache_dependencies
|
|
[]
|
|
end
|
|
|
|
def combined_fragment_cache_key(key)
|
|
[ :views, key ]
|
|
end
|
|
end.with_view_paths(view_paths, {})
|
|
|
|
controller = ActionController::Base.new
|
|
controller.perform_caching = true
|
|
@view.controller = controller
|
|
end
|
|
|
|
def test_only_preloading_for_records_that_miss_the_cache
|
|
@view.render partial: "test/partial", collection: [topics(:rails)], cached: true
|
|
|
|
@topics = Topic.preload(:replies)
|
|
|
|
@view.render partial: "test/partial", collection: @topics, cached: true
|
|
|
|
assert_not @topics.detect { |topic| topic.id == topics(:rails).id }.replies.loaded?
|
|
assert @topics.detect { |topic| topic.id != topics(:rails).id }.replies.loaded?
|
|
end
|
|
end
|