aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test/template/render_test.rb')
-rw-r--r--actionview/test/template/render_test.rb15
1 files changed, 12 insertions, 3 deletions
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