Sha256: 3b0474aaaa5c8094951a54d2365e59142044aa9bcc3f8f4202793bd1e3527f24

Contents?: true

Size: 920 Bytes

Versions: 15

Compression:

Stored size: 920 Bytes

Contents

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

class TestParameterResolver < Test::Unit::TestCase
  def test_handle_get
    v = WWW::Mechanize::Chain.new([
      WWW::Mechanize::Chain::ParameterResolver.new
    ])
    hash = {
      :uri    => URI.parse('http://google.com/'),
      :params => { :q => 'hello' },
      :verb   => :get
    }
    assert_nothing_raised {
      v.handle(hash)
    }
    assert_equal('q=hello', hash[:uri].query)
    assert_equal([], hash[:params])
  end

  def test_handle_post
    v = WWW::Mechanize::Chain.new([
      WWW::Mechanize::Chain::ParameterResolver.new
    ])
    hash = {
      :uri    => URI.parse('http://google.com/'),
      :params => { :q => 'hello' },
      :verb   => :post
    }
    assert_nothing_raised {
      v.handle(hash)
    }
    assert_equal('', hash[:uri].query.to_s)
    assert_equal({ :q => 'hello' }, hash[:params])
  end
end

Version data entries

15 entries across 15 versions & 5 rubygems

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