提交 84d0c30c 编写于 作者: C Carl Lerche

Allow view helper's #initialize method to be called. [#5061 state:resolved]

上级 4eb89873
......@@ -74,6 +74,11 @@ def helper_class
@helper_class ||= determine_default_helper_class(name)
end
def new(*)
include_helper_modules!
super
end
private
def include_helper_modules!
......@@ -89,7 +94,6 @@ def setup_with_controller
@output_buffer = ActiveSupport::SafeBuffer.new
@rendered = ''
self.class.send(:include_helper_modules!)
make_test_case_available_to_view!
say_no_to_protect_against_forgery!
end
......
......@@ -253,4 +253,17 @@ class RenderTemplateTest < ActionView::TestCase
end
end
end
module AHelperWithInitialize
def initialize(*)
super
@called_initialize = true
end
end
class AHelperWithInitializeTest < ActionView::TestCase
test "the helper's initialize was actually called" do
assert @called_initialize
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册