2017-07-23 11:36:41 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-06 12:50:17 -04:00
|
|
|
require "active_record_unit"
|
2015-08-28 01:31:54 -04:00
|
|
|
|
2016-10-28 23:05:58 -04:00
|
|
|
class RelationCacheTest < ActionView::TestCase
|
2015-08-28 01:31:54 -04:00
|
|
|
tests ActionView::Helpers::CacheHelper
|
|
|
|
|
|
|
|
def setup
|
2018-09-24 17:49:26 -04:00
|
|
|
super
|
2017-06-07 16:17:34 -04:00
|
|
|
view_paths = ActionController::Base.view_paths
|
|
|
|
lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"])
|
|
|
|
@view_renderer = ActionView::Renderer.new(lookup_context)
|
|
|
|
@virtual_path = "path"
|
|
|
|
|
2015-08-28 01:31:54 -04:00
|
|
|
controller.cache_store = ActiveSupport::Cache::MemoryStore.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_cache_relation_other
|
2016-08-16 03:30:11 -04:00
|
|
|
cache(Project.all) { concat("Hello World") }
|
2017-05-18 12:12:32 -04:00
|
|
|
assert_equal "Hello World", controller.cache_store.read("views/path/projects-#{Project.count}")
|
2015-08-28 01:31:54 -04:00
|
|
|
end
|
|
|
|
|
2018-09-07 14:45:01 -04:00
|
|
|
def view_cache_dependencies; []; end
|
2015-08-28 01:31:54 -04:00
|
|
|
end
|