Sha256: 2dc9aa7ebc5166818fac4d69add04d9c4fd12fdc1bee364dbb7c61d200150aa4

Contents?: true

Size: 916 Bytes

Versions: 15

Compression:

Stored size: 916 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "helper"))

class PostForm < Test::Unit::TestCase
  def setup
    @agent = WWW::Mechanize.new
  end

  def test_post_form
    page = @agent.post("http://localhost/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/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

15 entries across 15 versions & 5 rubygems

Version Path
eric-mechanize-0.9.3.20090623142847 test/test_post_form.rb
knu-mechanize-0.9.3.20090623142847 test/test_post_form.rb
tenderlove-mechanize-0.9.3.20090617085936 test/test_post_form.rb
tenderlove-mechanize-0.9.3.20090623142847 test/test_post_form.rb
mechanize-ntlm-0.9.1 test/test_post_form.rb
mechanize-0.8.0 test/test_post_form.rb
mechanize-0.8.4 test/test_post_form.rb
mechanize-0.8.1 test/test_post_form.rb
mechanize-0.8.3 test/test_post_form.rb
mechanize-0.8.2 test/test_post_form.rb
mechanize-0.9.1 test/test_post_form.rb
mechanize-0.9.2 test/test_post_form.rb
mechanize-0.9.3 test/test_post_form.rb
mechanize-0.9.0 test/test_post_form.rb
mechanize-0.8.5 test/test_post_form.rb