Namespace
Methods
C
S
T
Instance Public methods
call_controller(klass, action)
# File actionpack/test/controller/helper_test.rb, line 96
def call_controller(klass, action)
  request  = ActionController::TestRequest.new
  klass.action(action).call(request.env)
end
setup()
# File actionpack/test/controller/helper_test.rb, line 66
def setup
  # Increment symbol counter.
  @symbol = (@@counter ||= 'A0').succ!.dup

  # 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)

  # Set default test helper.
  self.test_helper = LocalAbcHelper
end
test_all_helpers()
# File actionpack/test/controller/helper_test.rb, line 137
def test_all_helpers
  methods = AllHelpersController._helpers.instance_methods.map {|m| m.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
test_all_helpers_with_alternate_helper_dir()
# File actionpack/test/controller/helper_test.rb, line 150
def test_all_helpers_with_alternate_helper_dir
  @controller_class.helpers_path = File.expand_path('../../fixtures/alternate_helpers', __FILE__)

  # Reload helpers
  @controller_class._helpers = Module.new
  @controller_class.helper :all

  # helpers/abc_helper.rb should not be included
  assert !master_helper_methods.include?('bare_a')

  # alternate_helpers/foo_helper.rb
  assert master_helper_methods.include?('baz')
end
test_base_helper_methods_after_clear_helpers()
# File actionpack/test/controller/helper_test.rb, line 125
def test_base_helper_methods_after_clear_helpers
  assert_nothing_raised do
    call_controller(JustMeController, "flash")
  end
end
test_default_helpers_only()
# File actionpack/test/controller/helper_test.rb, line 120
def test_default_helpers_only
  assert_equal [JustMeHelper], JustMeController._helpers.ancestors.reject(&:anonymous?)
  assert_equal [MeTooHelper, JustMeHelper], MeTooController._helpers.ancestors.reject(&:anonymous?)
end
test_helper()
# File actionpack/test/controller/helper_test.rb, line 79
def test_helper
  assert_equal expected_helper_methods, missing_methods
  assert_nothing_raised { @controller_class.helper TestHelper }
  assert_equal [], missing_methods
end
test_helper_attr()
# File actionpack/test/controller/helper_test.rb, line 90
def test_helper_attr
  assert_nothing_raised { @controller_class.helper_attr :delegate_attr }
  assert master_helper_methods.include?('delegate_attr')
  assert master_helper_methods.include?('delegate_attr=')
end
test_helper_for_acronym_controller()
# File actionpack/test/controller/helper_test.rb, line 110
def test_helper_for_acronym_controller
  assert_equal "test: baz", call_controller(Fun::PdfController, "test").last.body
  #
  # request  = ActionController::TestRequest.new
  # response = ActionController::TestResponse.new
  # request.action = 'test'
  #
  # assert_equal 'test: baz', Fun::PdfController.process(request, response).body
end
test_helper_for_nested_controller()
# File actionpack/test/controller/helper_test.rb, line 101
def test_helper_for_nested_controller
  assert_equal 'hello: Iz guuut!',
    call_controller(Fun::GamesController, "render_hello_world").last.body
  # request  = ActionController::TestRequest.new
  #
  # resp = Fun::GamesController.action(:render_hello_world).call(request.env)
  # assert_equal 'hello: Iz guuut!', resp.last.body
end
test_helper_method()
# File actionpack/test/controller/helper_test.rb, line 85
def test_helper_method
  assert_nothing_raised { @controller_class.helper_method :delegate_method }
  assert master_helper_methods.include?('delegate_method')
end
test_helper_proxy()
# File actionpack/test/controller/helper_test.rb, line 164
def test_helper_proxy
  methods = AllHelpersController.helpers.methods.map(&:to_s)

  # Action View
  assert methods.include?('pluralize')

  # 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
test_lib_helper_methods_after_clear_helpers()
# File actionpack/test/controller/helper_test.rb, line 131
def test_lib_helper_methods_after_clear_helpers
  assert_nothing_raised do
    call_controller(JustMeController, "lib")
  end
end