Sha256: e98ac8d779c84c623504fef241a09f2d4422636f8ee3edd1cf5fd2d21d6bb64d

Contents?: true

Size: 1010 Bytes

Versions: 3

Compression:

Stored size: 1010 Bytes

Contents

require "helper"

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

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

  def test_post_form_json
    page = @agent.post "http://localhost/form_post",
                       'json' => '["&quot;"]'

    assert page.links.find { |l| l.text == 'json:["""]' }
  end

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

    assert(page.links.find { |l| l.text == "gender:male" },
           "gender field missing")

    assert_equal(2, page.links.length)
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
aai10-mechanize-2.0.1.0 test/test_post_form.rb
neocoin-mechanize-2.0.2 test/test_post_form.rb
mechanize-2.0.1 test/test_post_form.rb