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



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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