2016-08-06 12:50:17 -04:00
|
|
|
require "abstract_unit"
|
2015-04-06 22:20:57 -04:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2016-08-07 19:05:28 -04:00
|
|
|
assert_equal SpecializedFormBuilder, default_form_builder
|
2015-04-06 22:20:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_assign_controller_skips_default_form_builder
|
|
|
|
@controller = OpenStruct.new
|
|
|
|
assign_controller(@controller)
|
|
|
|
|
2016-08-07 19:05:28 -04:00
|
|
|
assert_nil default_form_builder
|
2015-04-06 22:20:57 -04:00
|
|
|
end
|
|
|
|
end
|