Namespace
Methods
C
S
T
Instance Public methods
call_controller(klass, action)
# File actionpack/test/controller/helper_test.rb, line 137
def call_controller(klass, action)
  klass.action(action).call(ActionController::TestRequest::DEFAULT_ENV.dup)
end
setup()
# File actionpack/test/controller/helper_test.rb, line 107
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 167
def test_all_helpers
  methods = AllHelpersController._helpers.instance_methods

  # 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 180
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 155
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 150
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 120
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 131
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 146
def test_helper_for_acronym_controller
  assert_equal "test: baz", call_controller(Fun::PdfController, "test").last.body
end
test_helper_for_nested_controller()
# File actionpack/test/controller/helper_test.rb, line 141
def test_helper_for_nested_controller
  assert_equal 'hello: Iz guuut!',
    call_controller(Fun::GamesController, "render_hello_world").last.body
end
test_helper_method()
# File actionpack/test/controller/helper_test.rb, line 126
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 194
def test_helper_proxy
  methods = AllHelpersController.helpers.methods

  # 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_helper_proxy_config()
# File actionpack/test/controller/helper_test.rb, line 226
def test_helper_proxy_config
  AllHelpersController.config.my_var = 'smth'

  assert_equal 'smth', AllHelpersController.helpers.config.my_var
end
test_helper_proxy_in_instance()
# File actionpack/test/controller/helper_test.rb, line 210
def test_helper_proxy_in_instance
  methods = AllHelpersController.new.helpers.methods

  # Action View
  assert_includes methods, :pluralize

  # abc_helper.rb
  assert_includes methods, :bare_a

  # fun/games_helper.rb
  assert_includes methods, :stratego

  # fun/pdf_helper.rb
  assert_includes methods, :foobar
end
test_lib_helper_methods_after_clear_helpers()
# File actionpack/test/controller/helper_test.rb, line 161
def test_lib_helper_methods_after_clear_helpers
  assert_nothing_raised do
    call_controller(JustMeController, "lib")
  end
end