aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/compiled_templates_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2019-01-23 14:19:50 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2019-02-06 16:52:15 -0800
commitf9bea6304dfba902b1937b3bc29b1ebc2f67e55b (patch)
tree4859079e3b5c7055fb3b0b8b21bea08cd60de3f6 /actionview/test/template/compiled_templates_test.rb
parent9483cdee0a3ed9c686e338f079b0e369597b1211 (diff)
downloadrails-f9bea6304dfba902b1937b3bc29b1ebc2f67e55b.tar.gz
rails-f9bea6304dfba902b1937b3bc29b1ebc2f67e55b.tar.bz2
rails-f9bea6304dfba902b1937b3bc29b1ebc2f67e55b.zip
Move templates to an anonymous subclass of AV::Base
Now we can throw away the subclass and the generated methods will get GC'd too
Diffstat (limited to 'actionview/test/template/compiled_templates_test.rb')
-rw-r--r--actionview/test/template/compiled_templates_test.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/actionview/test/template/compiled_templates_test.rb b/actionview/test/template/compiled_templates_test.rb
index ded4786e62..3d4561b55f 100644
--- a/actionview/test/template/compiled_templates_test.rb
+++ b/actionview/test/template/compiled_templates_test.rb
@@ -3,7 +3,18 @@
require "abstract_unit"
class CompiledTemplatesTest < ActiveSupport::TestCase
- teardown do
+ attr_reader :view_class
+
+ def setup
+ super
+ view_paths = ActionController::Base.view_paths
+ view_paths.each(&:clear_cache)
+ ActionView::LookupContext.fallbacks.each(&:clear_cache)
+ @view_class = ActionView::Base.with_empty_template_cache
+ end
+
+ def teardown
+ super
ActionView::LookupContext::DetailsKey.clear
end
@@ -72,13 +83,13 @@ class CompiledTemplatesTest < ActiveSupport::TestCase
def render_with_cache(*args)
view_paths = ActionController::Base.view_paths
- ActionView::Base.with_view_paths(view_paths, {}).render(*args)
+ view_class.with_view_paths(view_paths, {}).render(*args)
end
def render_without_cache(*args)
path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH)
view_paths = ActionView::PathSet.new([path])
- ActionView::Base.with_view_paths(view_paths, {}).render(*args)
+ view_class.with_view_paths(view_paths, {}).render(*args)
end
def modify_template(template, content)