class 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.
Public Class Methods
new(hash = {})
click to toggle source
Calls superclass method
ActionView::FileSystemResolver.new
# File lib/action_view/testing/resolvers.rb, line 10 def initialize(hash = {}) super("") @hash = hash @path = "" end
Public Instance Methods
data()
click to toggle source
# File lib/action_view/testing/resolvers.rb, line 16 def data @hash end
to_s()
click to toggle source
# File lib/action_view/testing/resolvers.rb, line 20 def to_s @hash.keys.join(", ") end
Private Instance Methods
find_candidate_template_paths(path)
click to toggle source
# File lib/action_view/testing/resolvers.rb, line 25 def find_candidate_template_paths(path) @hash.keys.select do |fixture| fixture.start_with?(path.virtual) end.map do |fixture| "/#{fixture}" end end
source_for_template(template)
click to toggle source
# File lib/action_view/testing/resolvers.rb, line 33 def source_for_template(template) @hash[template[1..template.size]] end