vendor/rails/actionpack/test/controller/helper_test.rb in radiant-0.6.4 vs vendor/rails/actionpack/test/controller/helper_test.rb in radiant-0.6.5

- old
+ new

@@ -1,7 +1,9 @@ require File.dirname(__FILE__) + '/../abstract_unit' +ActionController::Helpers::HELPERS_DIR.replace File.dirname(__FILE__) + '/../fixtures/helpers' + class TestController < ActionController::Base attr_accessor :delegate_attr def delegate_method() end def rescue_action(e) raise end end @@ -13,19 +15,23 @@ end def rescue_action(e) raise end end - class PDFController < ActionController::Base + class PdfController < ActionController::Base def test render :inline => "test: <%= foobar %>" end def rescue_action(e) raise end end end +class ApplicationController < ActionController::Base + helper :all +end + module LocalAbcHelper def a() end def b() end def c() end end @@ -118,19 +124,32 @@ def test_helper_for_acronym_controller request = ActionController::TestRequest.new response = ActionController::TestResponse.new request.action = 'test' - assert_equal 'test: baz', Fun::PDFController.process(request, response).body + 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 + private def expected_helper_methods - TestHelper.instance_methods + TestHelper.instance_methods.map(&:to_s) end def master_helper_methods - @controller_class.master_helper_module.instance_methods + @controller_class.master_helper_module.instance_methods.map(&:to_s) end def missing_methods expected_helper_methods - master_helper_methods end