vendor/rails/actionpack/test/controller/helper_test.rb in radiant-0.6.9 vs vendor/rails/actionpack/test/controller/helper_test.rb in radiant-0.7.0

- old
+ new

@@ -1,6 +1,6 @@ -require File.dirname(__FILE__) + '/../abstract_unit' +require 'abstract_unit' ActionController::Helpers::HELPERS_DIR.replace File.dirname(__FILE__) + '/../fixtures/helpers' class TestController < ActionController::Base attr_accessor :delegate_attr @@ -44,26 +44,14 @@ # Generate new controller class. controller_class_name = "Helper#{@symbol}Controller" eval("class #{controller_class_name} < TestController; end") @controller_class = self.class.const_get(controller_class_name) - # Generate new template class and assign to controller. - template_class_name = "Test#{@symbol}View" - eval("class #{template_class_name} < ActionView::Base; end") - @template_class = self.class.const_get(template_class_name) - @controller_class.template_class = @template_class - # Set default test helper. self.test_helper = LocalAbcHelper end - - def teardown - # Reset template class. - #ActionController::Base.template_class = ActionView::Base - end - - + def test_deprecated_helper assert_equal expected_helper_methods, missing_methods assert_nothing_raised { @controller_class.helper TestHelper } assert_equal [], missing_methods end @@ -95,11 +83,11 @@ end def test_helper_block_include assert_equal expected_helper_methods, missing_methods assert_nothing_raised { - @controller_class.helper { include TestHelper } + @controller_class.helper { include HelperTest::TestHelper } } assert [], missing_methods end def test_helper_method @@ -129,9 +117,25 @@ assert_equal 'test: baz', Fun::PdfController.process(request, response).body end def test_all_helpers methods = ApplicationController.master_helper_module.instance_methods.map(&:to_s) + + # abc_helper.rb + assert methods.include?('bare_a') + + # fun/games_helper.rb + assert methods.include?('stratego') + + # fun/pdf_helper.rb + assert methods.include?('foobar') + end + + def test_helper_proxy + methods = ApplicationController.helpers.methods.map(&:to_s) + + # ActionView + assert methods.include?('pluralize') # abc_helper.rb assert methods.include?('bare_a') # fun/games_helper.rb