Module FormTestHelper::FormMethods
In: lib/form_methods.rb

Methods

Public Instance methods

[Source]

    # File lib/form_methods.rb, line 4
 4:     def select_form(text=nil, use_xhr=false)
 5:       @html_document = nil # So it always grabs the latest response
 6:       forms = case
 7:       when text.nil?
 8:         assert_select("form", 1)
 9:       when css_select(%Q{form[action="#{text}"]}).any?
10:         assert_select("form[action=?]", text)
11:       else
12:         assert_select('form#?', text)
13:       end
14:     
15:       returning Form.new(forms.first, self) do |form|
16:         if block_given?
17:           yield form
18:           form.submit :xhr => use_xhr
19:         end
20:       end
21:     end

Alias for select_form when called with a block. Shortcut for select_form(name).submit(args) without block.

[Source]

    # File lib/form_methods.rb, line 25
25:     def submit_form(*args, &block)
26:       if block_given?
27:         if args[0].is_a?(Hash)
28:           select_form(nil, args[0].delete(:xhr), &block)
29:         else
30:           select_form(*args, &block)
31:         end
32:       else
33:         selector = args[0].is_a?(Hash) ? nil : args.shift
34:         select_form(selector).submit(*args)
35:       end
36:     end

[Validate]