Methods

Class Index [+]

Quicksearch

ActionView::FixtureResolver

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.

Attributes

hash[R]

Public Class Methods

new(hash = {}, pattern=nil) click to toggle source
    # File lib/action_view/testing/resolvers.rb, line 11
11:     def initialize(hash = {}, pattern=nil)
12:       super(pattern)
13:       @hash = hash
14:     end

Public Instance Methods

to_s() click to toggle source
    # File lib/action_view/testing/resolvers.rb, line 16
16:     def to_s
17:       @hash.keys.join(', ')
18:     end

Private Instance Methods

query(path, exts, formats) click to toggle source
    # 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.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.