Module: ViewComponent::Form::TestHelpers

Defined in:
lib/view_component/form/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#form_with(object, builder: ViewComponent::Form::Builder, **options) ⇒ Object



10
11
12
# File 'lib/view_component/form/test_helpers.rb', line 10

def form_with(object, builder: ViewComponent::Form::Builder, **options)
  builder.new(object_name, object, template, options)
end

#object_nameObject



14
15
16
# File 'lib/view_component/form/test_helpers.rb', line 14

def object_name
  :user
end

#templateObject



19
20
21
22
23
# File 'lib/view_component/form/test_helpers.rb', line 19

def template
  lookup_context = ActionView::LookupContext.new(ActionController::Base.view_paths)

  ActionView::Base.new(lookup_context, {}, ApplicationController.new)
end