Use FixtureResolver in your tests to simulate the presence of files on the file system. This is used internally by Rails’ own test suite, and is useful for testing extensions that have no way of knowing what the file system will look like at runtime.
# File lib/action_view/testing/resolvers.rb, line 22 22: def query(path, exts, formats) 23: query = "" 24: EXTENSIONS.each do |ext| 25: query << '(' << exts[ext].map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)' 26: end 27: query = /^(#{Regexp.escape(path)})#{query}$/ 28: 29: templates = [] 30: @hash.each do |_path, array| 31: source, updated_at = array 32: next unless _path =~ query 33: handler, format = extract_handler_and_format(_path, formats) 34: templates << Template.new(source, _path, handler, 35: :virtual_path => path.virtual, :format => format, :updated_at => updated_at) 36: end 37: 38: templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } 39: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.