aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorTom Clarke <tom@u2i.com>2012-05-20 01:03:34 -0400
committerTom Clarke <tom@u2i.com>2012-05-21 15:24:07 -0400
commit2a121870a6aba2b40d65e75d8fa4f7b959aac2c9 (patch)
treeed462901756df33b9b24eccbbcec69091c89c52b /actionpack/test/template
parent776ea1090fb9ba4353035d4983cf1926a67b3294 (diff)
downloadrails-2a121870a6aba2b40d65e75d8fa4f7b959aac2c9.tar.gz
rails-2a121870a6aba2b40d65e75d8fa4f7b959aac2c9.tar.bz2
rails-2a121870a6aba2b40d65e75d8fa4f7b959aac2c9.zip
Make the Resolver template cache threadsafe - closes #6404
The Template cache in the Resolver can be accessed by multiple threads similtaneously in multi-threaded environments. The cache is implemented using a Hash, which isn't threadsafe in all VMs (notably JRuby). This commit extracts the cache to a new Cache class and adds mutexes to prevent concurrent access.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/lookup_context_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb
index 96b14a0acd..ef9c5ce10c 100644
--- a/actionpack/test/template/lookup_context_test.rb
+++ b/actionpack/test/template/lookup_context_test.rb
@@ -169,7 +169,7 @@ class LookupContextTest < ActiveSupport::TestCase
assert_not_equal template, old_template
end
-
+
test "responds to #prefixes" do
assert_equal [], @lookup_context.prefixes
@lookup_context.prefixes = ["foo"]
@@ -180,7 +180,7 @@ end
class LookupContextWithFalseCaching < ActiveSupport::TestCase
def setup
@resolver = ActionView::FixtureResolver.new("test/_foo.erb" => ["Foo", Time.utc(2000)])
- @resolver.stubs(:caching?).returns(false)
+ ActionView::Resolver.stubs(:caching?).returns(false)
@lookup_context = ActionView::LookupContext.new(@resolver, {})
end
@@ -247,6 +247,6 @@ class TestMissingTemplate < ActiveSupport::TestCase
@lookup_context.view_paths.find("foo", "parent", true, details)
end
assert_match %r{Missing partial parent/foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message
- end
-
+ end
+
end