mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Properly check the arity for template handlers.
This commit is contained in:
parent
28cf77203b
commit
cc70ac9508
2 changed files with 6 additions and 1 deletions
|
@ -275,7 +275,7 @@ module ActionView
|
|||
end
|
||||
|
||||
arity = @handler.respond_to?(:arity) ? @handler.arity : @handler.method(:call).arity
|
||||
code = arity == 1 ? @handler.call(self) : @handler.call(self, view)
|
||||
code = arity.abs == 1 ? @handler.call(self) : @handler.call(self, view)
|
||||
|
||||
# Make sure that the resulting String to be evalled is in the
|
||||
# encoding of the code
|
||||
|
|
|
@ -225,6 +225,11 @@ module RenderTestCases
|
|||
%'"#{template.class} #{view.class}"'
|
||||
end
|
||||
|
||||
def test_render_inline_with_render_from_to_proc
|
||||
ActionView::Template.register_template_handler :ruby_handler, :source.to_proc
|
||||
assert_equal '3', @view.render(:inline => "(1 + 2).to_s", :type => :ruby_handler)
|
||||
end
|
||||
|
||||
def test_render_inline_with_template_handler_with_view
|
||||
ActionView::Template.register_template_handler :with_view, WithViewHandler
|
||||
assert_equal 'ActionView::Template ActionView::Base', @view.render(:inline => "Hello, World!", :type => :with_view)
|
||||
|
|
Loading…
Reference in a new issue