class Capybara::Mechanize::Form

Public Instance Methods

params(button) click to toggle source
# File lib/capybara/mechanize/form.rb, line 3
def params(button)
  if !use_mechanize?
    return super
  end

  node = {}
  # Create a fake form
  class << node
    def search(*args); []; end
  end

  node['method'] = button && button['formmethod']

  node['method'] ||= (respond_to?(:request_method, true) ? request_method : method).to_s.upcase

  if self.multipart?
    node['enctype'] = 'multipart/form-data'
  else
    node['enctype'] = 'application/x-www-form-urlencoded'
  end

  @m_form = Mechanize::Form.new(node, nil, form_referer)

  super

  @m_form
end