diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-07 21:30:19 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-07 21:31:31 +0200 |
commit | c7760809bfc8e19362272b71b23a294d48195d65 (patch) | |
tree | 1666edc988670ebe6ccc966a778ebae1759b7f43 /actionpack/lib/action_view/testing | |
parent | c563f10f3e8083bebe32200fa065748c8bcb65c9 (diff) | |
download | rails-c7760809bfc8e19362272b71b23a294d48195d65.tar.gz rails-c7760809bfc8e19362272b71b23a294d48195d65.tar.bz2 rails-c7760809bfc8e19362272b71b23a294d48195d65.zip |
Allow cache to be temporarily disabled through lookup_context.
Diffstat (limited to 'actionpack/lib/action_view/testing')
-rw-r--r-- | actionpack/lib/action_view/testing/resolvers.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/testing/resolvers.rb b/actionpack/lib/action_view/testing/resolvers.rb index 6d82fa0971..ec0db48379 100644 --- a/actionpack/lib/action_view/testing/resolvers.rb +++ b/actionpack/lib/action_view/testing/resolvers.rb @@ -16,16 +16,18 @@ module ActionView #:nodoc: private def query(path, exts, formats) - query = Regexp.escape(path) + query = "" exts.each do |ext| query << '(' << ext.map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' end + query = /^(#{Regexp.escape(path)})#{query}$/ templates = [] - @hash.select { |k,v| k =~ /^#{query}$/ }.each do |_path, source| + @hash.each do |_path, source| + next unless _path =~ query handler, format = extract_handler_and_format(_path, formats) templates << Template.new(source, _path, handler, - :virtual_path => _path, :format => format) + :virtual_path => $1, :format => format) end templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } |