diff options
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/base.rb | 11 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 9 |
2 files changed, 7 insertions, 13 deletions
diff --git a/actionview/lib/action_view/base.rb b/actionview/lib/action_view/base.rb index c5d8cdd409..71aa68499d 100644 --- a/actionview/lib/action_view/base.rb +++ b/actionview/lib/action_view/base.rb @@ -182,11 +182,12 @@ module ActionView #:nodoc: end def with_empty_template_cache # :nodoc: - template_container = Module.new - Class.new(self) { - include template_container - define_method(:compiled_method_container) { template_container } - define_singleton_method(:compiled_method_container) { template_container } + subclass = Class.new(self) { + # We can't implement these as self.class because subclasses will + # share the same template cache as superclasses, so "changed?" won't work + # correctly. + define_method(:compiled_method_container) { subclass } + define_singleton_method(:compiled_method_container) { subclass } } end diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 372b85a4a5..b8d8717db4 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -19,15 +19,8 @@ module RenderTestCases end.with_view_paths(paths, @assigns) controller = TestController.new - view = @view - @controller_view = Class.new(controller.view_context_class) do - include view.compiled_method_container - - define_method(:compiled_method_container) do - view.compiled_method_container - end - end.new(controller.view_renderer, controller.view_assigns, controller) + @controller_view = controller.view_context_class.with_empty_template_cache.new(controller.view_renderer, controller.view_assigns, controller) # Reload and register danish language for testing I18n.backend.store_translations "da", {} |