Permalink
Browse files

Set format in finder

  • Loading branch information...
1 parent 3b9daf0 commit 03b8922ee4ba6051ae18917b5904f8664e715695 @lukaszx0 lukaszx0 committed Mar 13, 2014
Showing with 8 additions and 3 deletions.
  1. +8 −3 actionview/test/template/digestor_test.rb
@@ -16,20 +16,22 @@ class FixtureFinder
FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor"
attr_reader :details
+ attr_accessor :formats
attr_accessor :variants
def initialize
@details = {}
+ @formats = []
@variants = []
end
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

0 comments on commit 03b8922

Please sign in to comment.