Make sure the flash method is defined even if helpers are not present

上级 82556cd4
......@@ -33,12 +33,10 @@ def add_flash_types(*types)
types.each do |type|
next if _flash_types.include?(type)
if respond_to? :helper_method
define_method(type) do
request.flash[type]
end
helper_method type
define_method(type) do
request.flash[type]
end
helper_method(type) if respond_to?(:helper_method)
self._flash_types += [type]
end
......
......@@ -343,11 +343,18 @@ def test_flash_factored_into_etag
end
def test_flash_usable_in_metal_without_helper
controller_class = nil
assert_nothing_raised do
Class.new ActionController::Metal do
controller_class = Class.new(ActionController::Metal) do
include ActionController::Flash
end
end
controller = controller_class.new
assert_respond_to controller, :alert
assert_respond_to controller, :notice
end
private
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册