module WithForm::TestHelpers

Public Instance Methods

with_form(scope: nil, model: nil, &block) click to toggle source
# 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