diff options
Diffstat (limited to 'actionpack/test/controller/flash_test.rb')
-rw-r--r-- | actionpack/test/controller/flash_test.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb index 3b874a739a..9ceab91e42 100644 --- a/actionpack/test/controller/flash_test.rb +++ b/actionpack/test/controller/flash_test.rb @@ -174,12 +174,12 @@ class FlashTest < ActionController::TestCase flash.update(:foo => :foo_indeed, :bar => :bar_indeed) assert_equal(:foo_indeed, flash.discard(:foo)) # valid key passed - assert_nil flash.discard(:unknown) # non existant key passed + assert_nil flash.discard(:unknown) # non existent key passed assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.discard().to_hash) # nothing passed assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.discard(nil).to_hash) # nothing passed assert_equal(:foo_indeed, flash.keep(:foo)) # valid key passed - assert_nil flash.keep(:unknown) # non existant key passed + assert_nil flash.keep(:unknown) # non existent key passed assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep().to_hash) # nothing passed assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep(nil).to_hash) # nothing passed end @@ -214,6 +214,18 @@ class FlashTest < ActionController::TestCase get :redirect_with_foo_flash assert_equal "for great justice", @controller.send(:flash)[:foo] end + + class SubclassesTestController < TestController; end + + def test_add_flash_type_to_subclasses + TestController.add_flash_types :foo + assert SubclassesTestController._flash_types.include?(:foo) + end + + def test_do_not_add_flash_type_to_parent_class + SubclassesTestController.add_flash_types :bar + assert_not TestController._flash_types.include?(:bar) + end end class FlashIntegrationTest < ActionDispatch::IntegrationTest |