diff options
author | José Valim <jose.valim@gmail.com> | 2010-08-26 16:03:10 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-26 16:07:54 -0300 |
commit | 66ef92272c5d6519b425e73e500bbae1a75b348e (patch) | |
tree | 8946ded090a491037bf6fc4150708baf5b48154d /actionpack/test | |
parent | 84cab320bc1faaddc142cbbb38713d3f29a8b07d (diff) | |
download | rails-66ef92272c5d6519b425e73e500bbae1a75b348e.tar.gz rails-66ef92272c5d6519b425e73e500bbae1a75b348e.tar.bz2 rails-66ef92272c5d6519b425e73e500bbae1a75b348e.zip |
Add clear_helpers as a way to clean up all helpers added to this controller, maintaing just the helper with the same name as the controller.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/abstract/helper_test.rb | 21 | ||||
-rw-r--r-- | actionpack/test/fixtures/helpers/helpery_test_helper.rb | 5 |
2 files changed, 24 insertions, 2 deletions
diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb index 73941222dc..b28a5b5afb 100644 --- a/actionpack/test/abstract/helper_test.rb +++ b/actionpack/test/abstract/helper_test.rb @@ -38,6 +38,10 @@ module AbstractController end end + class ::HelperyTestController < AbstractHelpers + clear_helpers + end + class AbstractHelpersBlock < ControllerWithHelpers helper do include ::AbstractController::Testing::HelperyTest @@ -45,7 +49,6 @@ module AbstractController end class TestHelpers < ActiveSupport::TestCase - def setup @controller = AbstractHelpers.new end @@ -74,8 +77,22 @@ module AbstractController @controller.process(:with_module) assert_equal "Module Included", @controller.response_body end - end + class ClearHelpersTest < ActiveSupport::TestCase + def setup + @controller = HelperyTestController.new + end + + def test_clears_up_previous_helpers + @controller.process(:with_symbol) + assert_equal "I respond to bare_a: false", @controller.response_body + end + + def test_includes_controller_default_helper + @controller.process(:with_block) + assert_equal "Hello Default", @controller.response_body + end + end end end diff --git a/actionpack/test/fixtures/helpers/helpery_test_helper.rb b/actionpack/test/fixtures/helpers/helpery_test_helper.rb new file mode 100644 index 0000000000..a4f2951efa --- /dev/null +++ b/actionpack/test/fixtures/helpers/helpery_test_helper.rb @@ -0,0 +1,5 @@ +module HelperyTestHelper + def helpery_test + "Default" + end +end |