aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorst0012 <stan001212@gmail.com>2019-05-06 20:06:35 +0800
committerst0012 <stan001212@gmail.com>2019-05-06 22:08:48 +0800
commit34a33f8b0c234fcbc06a15c958b079a0f5b4400c (patch)
treeda3bd780a0b9419f544b6fe6b810df271eac29f0 /actionview/test
parent85a8bc644be69908f05740a5886ec19cd3679df5 (diff)
downloadrails-34a33f8b0c234fcbc06a15c958b079a0f5b4400c.tar.gz
rails-34a33f8b0c234fcbc06a15c958b079a0f5b4400c.tar.bz2
rails-34a33f8b0c234fcbc06a15c958b079a0f5b4400c.zip
Clear Resolvers' cache after running RenderTestCases' test cases
The templates rendered in RenderTestCases tests will be cached by the resolvers unexpectedly. And this will break other tests when executed in certain order. (See https://github.com/rails/rails/issues/36154 for more detail) So to fix this issue, we just need to clear the caches on all resolvers.
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/render_test.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index f0b5d7d95e..4bc7d72464 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -33,6 +33,11 @@ module RenderTestCases
assert_equal ORIGINAL_LOCALES, I18n.available_locales.map(&:to_s).sort
end
+ def teardown
+ I18n.reload!
+ ActionController::Base.view_paths.map(&:clear_cache)
+ end
+
def test_implicit_format_comes_from_parent_template
rendered_templates = JSON.parse(@controller_view.render(template: "test/mixing_formats"))
assert_equal({ "format" => "HTML",
@@ -680,7 +685,7 @@ class CachedViewRenderTest < ActiveSupport::TestCase
def teardown
GC.start
- I18n.reload!
+ super
end
end
@@ -699,7 +704,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
def teardown
GC.start
- I18n.reload!
+ super
end
def test_render_utf8_template_with_magic_comment
@@ -758,8 +763,8 @@ class CachedCollectionViewRenderTest < ActiveSupport::TestCase
setup_view(view_paths)
end
- teardown do
- I18n.reload!
+ def teardown
+ super
end
test "template body written to cache" do