Class: Capybara::Mechanize::Form

Inherits:
RackTest::Form
  • Object
show all
Defined in:
lib/capybara/mechanize/form.rb

Instance Method Summary collapse

Instance Method Details

#params(button) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/capybara/mechanize/form.rb', line 4

def params(button)
  return super unless use_mechanize?

  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

  node['enctype'] = multipart? ? 'multipart/form-data' : 'application/x-www-form-urlencoded'

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

  super

  @m_form
end