1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionview/test/template/controller_helper_test.rb
Rafael França 9c35bf2a6a Merge pull request #29897 from kirs/frozen-actionview
Use frozen string literal in actionview/
2017-07-24 15:54:08 -04:00

34 lines
916 B
Ruby

# frozen_string_literal: true
require "abstract_unit"
class ControllerHelperTest < ActionView::TestCase
tests ActionView::Helpers::ControllerHelper
class SpecializedFormBuilder < ActionView::Helpers::FormBuilder ; end
def test_assign_controller_sets_default_form_builder
@controller = OpenStruct.new(default_form_builder: SpecializedFormBuilder)
assign_controller(@controller)
assert_equal SpecializedFormBuilder, default_form_builder
end
def test_assign_controller_skips_default_form_builder
@controller = OpenStruct.new
assign_controller(@controller)
assert_nil default_form_builder
end
def test_respond_to
@controller = OpenStruct.new
assign_controller(@controller)
assert_not respond_to?(:params)
assert respond_to?(:assign_controller)
@controller.params = {}
assert respond_to?(:params)
assert respond_to?(:assign_controller)
end
end