File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed
lib/action_controller/metal Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,12 @@ def add_flash_types(*types)
38
38
define_method ( type ) do
39
39
request . flash [ type ]
40
40
end
41
+ private type
41
42
helper_method ( type ) if respond_to? ( :helper_method )
42
43
43
44
self . _flash_types += [ type ]
44
45
end
45
46
end
46
-
47
- def action_methods # :nodoc:
48
- @action_methods ||= super - _flash_types . map ( &:to_s ) . to_set
49
- end
50
47
end
51
48
52
49
private
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ def use_flash
274
274
275
275
def set_bar
276
276
flash [ :bar ] = "for great justice"
277
- head :ok
277
+ render inline : "<%= bar %>"
278
278
end
279
279
280
280
def set_flash_optionally
@@ -330,7 +330,7 @@ def test_added_flash_types_method
330
330
with_test_route_set do
331
331
get "/set_bar"
332
332
assert_response :success
333
- assert_equal "for great justice" , @controller . bar
333
+ assert_equal "for great justice" , response . body
334
334
end
335
335
end
336
336
@@ -356,7 +356,7 @@ def test_flash_factored_into_etag
356
356
end
357
357
end
358
358
359
- def test_flash_usable_in_metal_without_helper
359
+ def test_flash_unusable_in_metal_without_helper
360
360
controller_class = nil
361
361
362
362
assert_nothing_raised do
@@ -367,8 +367,11 @@ def test_flash_usable_in_metal_without_helper
367
367
368
368
controller = controller_class . new
369
369
370
- assert_respond_to controller , :alert
371
- assert_respond_to controller , :notice
370
+ assert_not_respond_to controller , :alert
371
+ assert_not_respond_to controller , :notice
372
+
373
+ assert_includes controller . private_methods , :alert
374
+ assert_includes controller . private_methods , :notice
372
375
end
373
376
374
377
private
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class JustMeController < ActionController::Base
37
37
clear_helpers
38
38
39
39
def flash
40
- render inline : "<h1><%= notice %></h1>"
40
+ render inline : "<h1><%= request.flash[: notice] %></h1>"
41
41
end
42
42
43
43
def lib
You can’t perform that action at this time.
0 commit comments