Module: WithForm::TestHelpers

Defined in:
lib/with_form/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#with_form(scope: nil, model: nil, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/with_form/test_helpers.rb', line 6

def with_form(scope: nil, model: nil, &block)
  if model.present?
    WithForm::ModelForm.new(model: model, page: page).yield_self(&block)
  elsif scope.present?
    WithForm::ScopeForm.new(scope: scope, page: page).yield_self(&block)
  else
    raise "with_form must be invoked with either a scope: or model: option"
  end
end