diff options
author | Javan Makhmali <javan@javan.us> | 2016-06-14 17:23:44 -0400 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2016-06-15 18:25:18 -0400 |
commit | 2451177f37aa252513ac372d24cba6a3c44c054b (patch) | |
tree | 92dc144312995a07a49062ba5d12b2914518402d /actionview/test/template | |
parent | 7980b31bc6dd123a0635f470998362a602b66e25 (diff) | |
download | rails-2451177f37aa252513ac372d24cba6a3c44c054b.tar.gz rails-2451177f37aa252513ac372d24cba6a3c44c054b.tar.bz2 rails-2451177f37aa252513ac372d24cba6a3c44c054b.zip |
Fix digesting templates with identical logical names when requesting a format other than the first default
Diffstat (limited to 'actionview/test/template')
-rw-r--r-- | actionview/test/template/digestor_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index 4750d2a5a3..3dad70f464 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -18,6 +18,7 @@ class FixtureFinder < ActionView::LookupContext def initialize(details = {}) super(ActionView::PathSet.new(['digestor']), details, []) + @rendered_format = :html end end @@ -280,6 +281,12 @@ class TemplateDigestorTest < ActionView::TestCase end end + def test_different_formats + html_digest = digest("comments/_comment", format: :html) + json_digest = digest("comments/_comment", format: :json) + + assert_not_equal html_digest, json_digest + end private def assert_logged(message) @@ -309,8 +316,11 @@ class TemplateDigestorTest < ActionView::TestCase def digest(template_name, options = {}) options = options.dup + finder_options = options.extract!(:variants, :format) + + finder.variants = finder_options[:variants] || [] + finder.rendered_format = finder_options[:format] if finder_options[:format] - finder.variants = options.delete(:variants) || [] ActionView::Digestor.digest(name: template_name, finder: finder, dependencies: (options[:dependencies] || [])) end |