Make sure the flash method is defined even if helpers are not present
This commit is contained in:
parent
82556cd452
commit
7265b89780
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user