add query params test
parent
dc11231a4d
commit
663e6dac5d
|
@ -3,11 +3,21 @@ require "webmock"
|
||||||
WebMock.stub(:any, "example.com")
|
WebMock.stub(:any, "example.com")
|
||||||
|
|
||||||
describe Mechanize do
|
describe Mechanize do
|
||||||
it "simple get" do
|
it "simple GET" do
|
||||||
agent = Mechanize.new
|
agent = Mechanize.new
|
||||||
uri = "http://example.com/"
|
uri = "http://example.com/"
|
||||||
page = agent.get(uri)
|
page = agent.get(uri)
|
||||||
page.code.should eq 200
|
page.code.should eq 200
|
||||||
page.uri.to_s.should eq uri
|
page.uri.to_s.should eq uri
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "GET with query parameter" do
|
||||||
|
WebMock.stub(:get, "http://example.com/?foo=bar&foo1=bar2")
|
||||||
|
agent = Mechanize.new
|
||||||
|
params = {"foo" => "bar", "foo1" => "bar2"}
|
||||||
|
uri = "http://example.com/"
|
||||||
|
page = agent.get(uri, params: params)
|
||||||
|
page.code.should eq 200
|
||||||
|
page.uri.to_s.should eq "http://example.com/?foo=bar&foo1=bar2"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue