From f3531a8fc9f661f96759f0a851540745876e5d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 14 Dec 2011 09:23:34 +0100 Subject: [PATCH] Clean up details keys before some tests to expire the cache. --- actionpack/lib/action_view/lookup_context.rb | 4 ++++ actionpack/test/template/compiled_templates_test.rb | 4 ++++ actionpack/test/template/lookup_context_test.rb | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 9bf4289f42..3bb2b98e48 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -59,6 +59,10 @@ def self.get(details) @details_keys[details] ||= new end + def self.clear + @details_keys.clear + end + def initialize @hash = object_hash end diff --git a/actionpack/test/template/compiled_templates_test.rb b/actionpack/test/template/compiled_templates_test.rb index 8fc78283d8..30d798d693 100644 --- a/actionpack/test/template/compiled_templates_test.rb +++ b/actionpack/test/template/compiled_templates_test.rb @@ -3,6 +3,10 @@ class CompiledTemplatesTest < Test::Unit::TestCase def setup + # Clean up any details key cached to expose failures + # that otherwise would appear just on isolated tests + ActionView::LookupContext::DetailsKey.clear + @compiled_templates = ActionView::CompiledTemplates @compiled_templates.instance_methods.each do |m| @compiled_templates.send(:remove_method, m) if m =~ /^_render_template_/ diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index bac2530e3d..c65f707da0 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -1,20 +1,14 @@ require "abstract_unit" require "abstract_controller/rendering" -ActionView::LookupContext::DetailsKey.class_eval do - def self.details_keys - @details_keys - end -end - class LookupContextTest < ActiveSupport::TestCase def setup @lookup_context = ActionView::LookupContext.new(FIXTURE_LOAD_PATH, {}) + ActionView::LookupContext::DetailsKey.clear end def teardown I18n.locale = :en - ActionView::LookupContext::DetailsKey.details_keys.clear end test "process view paths on initialization" do -- GitLab