aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorRicardo de Cillo <ricardo.cillo@plataformatec.com.br>2013-09-13 10:03:38 -0300
committerRicardo de Cillo <ricardo.cillo@plataformatec.com.br>2013-09-13 10:19:29 -0300
commit1413ee991ccfc76b24f29eb03c9cff82e588e5d7 (patch)
tree372297500443ba2bd8300713243a5308db541e91 /actionpack/test
parentdefdeed2fc1f6f30c8eeebc7e2695d82624942e2 (diff)
downloadrails-1413ee991ccfc76b24f29eb03c9cff82e588e5d7.tar.gz
rails-1413ee991ccfc76b24f29eb03c9cff82e588e5d7.tar.bz2
rails-1413ee991ccfc76b24f29eb03c9cff82e588e5d7.zip
Custom flash should be defined only for the class that defines it and it's subclasses.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/flash_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/controller/flash_test.rb b/actionpack/test/controller/flash_test.rb
index 3b874a739a..c64ffef654 100644
--- a/actionpack/test/controller/flash_test.rb
+++ b/actionpack/test/controller/flash_test.rb
@@ -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