diff options
author | Chris Kowalik <chris@nu7hat.ch> | 2011-03-19 12:13:59 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-03-20 07:01:46 +0800 |
commit | de1fe5e8a723baa095e83bb3ddca6af73b0aab5d (patch) | |
tree | ce87fd1af3e71137fb92f9219f55fd4555dc40d6 /actionpack/lib/action_view/testing | |
parent | 445241d713782262134ede64a967369f803076ff (diff) | |
download | rails-de1fe5e8a723baa095e83bb3ddca6af73b0aab5d.tar.gz rails-de1fe5e8a723baa095e83bb3ddca6af73b0aab5d.tar.bz2 rails-de1fe5e8a723baa095e83bb3ddca6af73b0aab5d.zip |
[action_view] added custom patterns to template resolver
Diffstat (limited to 'actionpack/lib/action_view/testing')
-rw-r--r-- | actionpack/lib/action_view/testing/resolvers.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/testing/resolvers.rb b/actionpack/lib/action_view/testing/resolvers.rb index 5c5cab7c7d..773dfcbb1d 100644 --- a/actionpack/lib/action_view/testing/resolvers.rb +++ b/actionpack/lib/action_view/testing/resolvers.rb @@ -8,8 +8,8 @@ module ActionView #:nodoc: class FixtureResolver < PathResolver attr_reader :hash - def initialize(hash = {}) - super() + def initialize(hash = {}, pattern=nil) + super(pattern) @hash = hash end @@ -21,8 +21,8 @@ module ActionView #:nodoc: def query(path, exts, formats) query = "" - exts.each do |ext| - query << '(' << ext.map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' + EXTENSIONS.each do |ext| + query << '(' << exts[ext].map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' end query = /^(#{Regexp.escape(path)})#{query}$/ @@ -32,9 +32,9 @@ module ActionView #:nodoc: next unless _path =~ query handler, format = extract_handler_and_format(_path, formats) templates << Template.new(source, _path, handler, - :virtual_path => $1, :format => format, :updated_at => updated_at) + :virtual_path => path.virtual, :format => format, :updated_at => updated_at) end - + templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } end end |