Sha256: c2ea9430bc990c76b38e2f35fddb1d7f1c8ec4eede650b27b9e158a4d2c3bbcb

Contents?: true

Size: 889 Bytes

Versions: 9

Compression:

Stored size: 889 Bytes

Contents

require 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

9 entries across 9 versions & 1 rubygems

Version Path
mechanize-0.7.8 test/test_post_form.rb
mechanize-0.7.1 test/tc_post_form.rb
mechanize-0.7.0 test/tc_post_form.rb
mechanize-0.7.2 test/tc_post_form.rb
mechanize-0.7.3 test/tc_post_form.rb
mechanize-0.7.4 test/tc_post_form.rb
mechanize-0.7.5 test/tc_post_form.rb
mechanize-0.7.6 test/tc_post_form.rb
mechanize-0.7.7 test/test_post_form.rb