diff options
author | Aaron Patterson <tenderlove@github.com> | 2019-02-01 17:25:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-01 17:25:45 -0800 |
commit | e50ed29e53ebade52eb244880b5012bbbd6e022f (patch) | |
tree | 53740508926a48a35eab3264754e1cad9525d35e /actionview/test/template | |
parent | 2ccbddb48c96b0cda9641961541d7266591a3db7 (diff) | |
parent | 28f88e0074f473f58c2d3fd54cb3daff81027c12 (diff) | |
download | rails-e50ed29e53ebade52eb244880b5012bbbd6e022f.tar.gz rails-e50ed29e53ebade52eb244880b5012bbbd6e022f.tar.bz2 rails-e50ed29e53ebade52eb244880b5012bbbd6e022f.zip |
Merge pull request #35119 from rails/file-template
Introduce a file type template
Diffstat (limited to 'actionview/test/template')
-rw-r--r-- | actionview/test/template/dependency_tracker_test.rb | 4 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/actionview/test/template/dependency_tracker_test.rb b/actionview/test/template/dependency_tracker_test.rb index ef7aeac039..42cb14a18a 100644 --- a/actionview/test/template/dependency_tracker_test.rb +++ b/actionview/test/template/dependency_tracker_test.rb @@ -17,8 +17,8 @@ class FakeTemplate end end -Neckbeard = lambda { |template| template.source } -Bowtie = lambda { |template| template.source } +Neckbeard = lambda { |template, source| source } +Bowtie = lambda { |template, source| source } class DependencyTrackerTest < ActionView::TestCase def tracker diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 76ffe3415d..f5d251da20 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -450,13 +450,22 @@ module RenderTestCases assert_equal "Hello, World!", @view.render(inline: "Hello, World!", type: :bar) end - CustomHandler = lambda do |template| + CustomHandler = lambda do |template, source| "@output_buffer = ''.dup\n" \ - "@output_buffer << 'source: #{template.source.inspect}'\n" + "@output_buffer << 'source: #{source.inspect}'\n" end def test_render_inline_with_render_from_to_proc - ActionView::Template.register_template_handler :ruby_handler, :source.to_proc + ActionView::Template.register_template_handler :ruby_handler, lambda { |_, source| source } + assert_equal "3", @view.render(inline: "(1 + 2).to_s", type: :ruby_handler) + ensure + ActionView::Template.unregister_template_handler :ruby_handler + end + + def test_render_inline_with_render_from_to_proc_deprecated + assert_deprecated do + ActionView::Template.register_template_handler :ruby_handler, :source.to_proc + end assert_equal "3", @view.render(inline: "(1 + 2).to_s", type: :ruby_handler) ensure ActionView::Template.unregister_template_handler :ruby_handler |