Class: ActionView::FixtureResolver
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
FileSystemResolver,
Resolver
|
|
|
Instance Chain:
self,
FileSystemResolver,
Resolver
|
|
| Inherits: |
ActionView::FileSystemResolver
|
| Defined in: | actionview/lib/action_view/testing/resolvers.rb |
Overview
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.
Class Attribute Summary
Resolver - Inherited
| .caching? | Alias for Resolver.caching. |
Class Method Summary
Instance Attribute Summary
Instance Method Summary
- #data
- #to_s
- #source_for_template(template) private
- #template_glob(glob) private
FileSystemResolver - Inherited
Resolver - Inherited
| #caching?, #clear_cache, #find, #find_all, | |
| #find_templates | Extension point for custom resolvers: implement this method, or override find_all/find directly. |
| #all_template_paths, #built_templates | |
Constructor Details
.new(hash = {}) ⇒ FixtureResolver
# File 'actionview/lib/action_view/testing/resolvers.rb', line 12
def initialize(hash = {}) super("") @hash = hash @path = "" end
Instance Method Details
#data
[ GitHub ]# File 'actionview/lib/action_view/testing/resolvers.rb', line 18
def data @hash end
#source_for_template(template) (private)
[ GitHub ]# File 'actionview/lib/action_view/testing/resolvers.rb', line 33
def source_for_template(template) @hash[template.from(1)] end
#template_glob(glob) (private)
[ GitHub ]# File 'actionview/lib/action_view/testing/resolvers.rb', line 27
def template_glob(glob) @hash.keys.filter_map do |path| "/#{path}" if File.fnmatch(glob, path) end end
#to_s
[ GitHub ]# File 'actionview/lib/action_view/testing/resolvers.rb', line 22
def to_s @hash.keys.join(", ") end