diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-08-14 01:13:43 +0200 |
---|---|---|
committer | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-08-25 11:40:11 +0200 |
commit | e10a25310f0fd7fb210b31124d6ea262a90b4717 (patch) | |
tree | f7fb8ada4bd2f202689e81fec6fc2714fa8c0428 /actionpack/test/abstract/helper_test.rb | |
parent | 7620ab08be5cbc3621169d1b0e0bcd628732905b (diff) | |
download | rails-e10a25310f0fd7fb210b31124d6ea262a90b4717.tar.gz rails-e10a25310f0fd7fb210b31124d6ea262a90b4717.tar.bz2 rails-e10a25310f0fd7fb210b31124d6ea262a90b4717.zip |
Move abstract's controller tests to AV
The ones that were actually testing AV functionality and should belong in there
Diffstat (limited to 'actionpack/test/abstract/helper_test.rb')
-rw-r--r-- | actionpack/test/abstract/helper_test.rb | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/actionpack/test/abstract/helper_test.rb b/actionpack/test/abstract/helper_test.rb deleted file mode 100644 index a596ebe6f7..0000000000 --- a/actionpack/test/abstract/helper_test.rb +++ /dev/null @@ -1,127 +0,0 @@ -require 'abstract_unit' - -ActionController::Base.helpers_path = File.expand_path('../../fixtures/helpers', __FILE__) - -module AbstractController - module Testing - - class ControllerWithHelpers < AbstractController::Base - include AbstractController::Helpers - include AbstractController::Rendering - include ActionView::Rendering - - def with_module - render :inline => "Module <%= included_method %>" - end - end - - module HelperyTest - def included_method - "Included" - end - end - - class AbstractHelpers < ControllerWithHelpers - helper(HelperyTest) do - def helpery_test - "World" - end - end - - helper :abc - - def with_block - render :inline => "Hello <%= helpery_test %>" - end - - def with_symbol - render :inline => "I respond to bare_a: <%= respond_to?(:bare_a) %>" - end - end - - class ::HelperyTestController < AbstractHelpers - clear_helpers - end - - class AbstractHelpersBlock < ControllerWithHelpers - helper do - include AbstractController::Testing::HelperyTest - end - end - - class AbstractInvalidHelpers < AbstractHelpers - include ActionController::Helpers - - path = File.join(File.expand_path('../../fixtures', __FILE__), "helpers_missing") - $:.unshift(path) - self.helpers_path = path - end - - class TestHelpers < ActiveSupport::TestCase - def setup - @controller = AbstractHelpers.new - end - - def test_helpers_with_block - @controller.process(:with_block) - assert_equal "Hello World", @controller.response_body - end - - def test_helpers_with_module - @controller.process(:with_module) - assert_equal "Module Included", @controller.response_body - end - - def test_helpers_with_symbol - @controller.process(:with_symbol) - assert_equal "I respond to bare_a: true", @controller.response_body - end - - def test_declare_missing_helper - AbstractHelpers.helper :missing - flunk "should have raised an exception" - rescue LoadError => e - assert_equal "helpers/missing_helper.rb", e.path - end - - def test_helpers_with_module_through_block - @controller = AbstractHelpersBlock.new - @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 - - class InvalidHelpersTest < ActiveSupport::TestCase - def test_controller_raise_error_about_real_require_problem - e = assert_raise(LoadError) { AbstractInvalidHelpers.helper(:invalid_require) } - assert_equal "No such file to load -- very_invalid_file_name", e.message - end - - def test_controller_raise_error_about_missing_helper - e = assert_raise(AbstractController::Helpers::MissingHelperError) { AbstractInvalidHelpers.helper(:missing) } - assert_equal "Missing helper file helpers/missing_helper.rb", e.message - end - - def test_missing_helper_error_has_the_right_path - e = assert_raise(AbstractController::Helpers::MissingHelperError) { AbstractInvalidHelpers.helper(:missing) } - assert_equal "helpers/missing_helper.rb", e.path - end - end - end -end |