Sha256: 7c5ef126d4e25142c04c4c144395a84340fe4f6468f618d3ea530e08375ff95b

Contents?: true

Size: 1 KB

Versions: 14

Compression:

Stored size: 1 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")

require 'test/unit'
require 'rubygems'
require 'mechanize'
require 'test_includes'

class PostForm < Test::Unit::TestCase
  include TestMethods

  def setup
    @agent = WWW::Mechanize.new
  end

  def test_post_form
    page = @agent.post("http://localhost:#{PORT}/form_post",
                        'gender' => 'female'
                      )
    assert_not_nil(
      page.links.find { |l| l.text == "gender:female" },
      "gender field missing"
    )
  end

  def test_post_form_multival
    page = @agent.post("http://localhost:#{PORT}/form_post",
                       [ ['gender', 'female'],
                         ['gender', 'male']
                       ]
                      )
    assert_not_nil(
      page.links.find { |l| l.text == "gender:female" },
      "gender field missing"
    )
    assert_not_nil(
      page.links.find { |l| l.text == "gender:male" },
      "gender field missing"
    )
    assert_equal(2, page.links.length)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mechanize-0.5.3 test/tc_post_form.rb
mechanize-0.6.0 test/tc_post_form.rb
mechanize-0.6.1 test/tc_post_form.rb
mechanize-0.6.10 test/tc_post_form.rb
mechanize-0.5.4 test/tc_post_form.rb
mechanize-0.6.4 test/tc_post_form.rb
mechanize-0.6.5 test/tc_post_form.rb
mechanize-0.6.7 test/tc_post_form.rb
mechanize-0.6.9 test/tc_post_form.rb
mechanize-0.6.8 test/tc_post_form.rb
mechanize-0.6.6 test/tc_post_form.rb
mechanize-0.6.3 test/tc_post_form.rb
mechanize-0.6.11 test/tc_post_form.rb
mechanize-0.6.2 test/tc_post_form.rb