Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set format in finder

  • Loading branch information...
commit 03b8922ee4ba6051ae18917b5904f8664e715695 1 parent 3b9daf0
Łukasz Strzałkowski strzalek authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 actionview/test/template/digestor_test.rb
11 actionview/test/template/digestor_test.rb
View
@@ -16,10 +16,12 @@ class FixtureFinder
FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor"
attr_reader :details
+ attr_accessor :formats
attr_accessor :variants
def initialize
@details = {}
+ @formats = []
@variants = []
end
@@ -27,9 +29,9 @@ def details_key
details.hash
end
- def find(logical_name, keys, partial, options)
- partial_name = partial ? logical_name.gsub(%r|/([^/]+)$|, '/_\1') : logical_name
- format = options[:formats].first.to_s
+ def find(name, prefixes = [], partial = false, keys = [], options = {})
+ partial_name = partial ? name.gsub(%r|/([^/]+)$|, '/_\1') : name
+ format = @formats.first.to_s
format += "+#{@variants.first}" if @variants.any?
FixtureTemplate.new("digestor/#{partial_name}.#{format}.erb")
@@ -288,6 +290,9 @@ def assert_digest_difference(template_name, persistent = false, options = {})
def digest(template_name, options = {})
options = options.dup
+ finder.formats = [:html]
+ finder.variants = [options[:variant]] if options[:variant].present?
+
ActionView::Digestor.digest({ name: template_name, format: :html, finder: finder }.merge(options))
end
Please sign in to comment.
Something went wrong with that request. Please try again.