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



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

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

#object_nameObject



18
19
20
# File 'lib/view_component/form/test_helpers.rb', line 18

def object_name
  :user
end

#templateObject



22
23
24
25
26
# File 'lib/view_component/form/test_helpers.rb', line 22

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

  TestView.new(lookup_context, {}, ApplicationController.new)
end