add query params test

master
Kanezoh 2021-06-09 22:36:35 +09:00
parent dc11231a4d
commit 663e6dac5d
1 changed files with 11 additions and 1 deletions

View File

@ -3,11 +3,21 @@ require "webmock"
WebMock.stub(:any, "example.com")
describe Mechanize do
it "simple get" do
it "simple GET" do
agent = Mechanize.new
uri = "http://example.com/"
page = agent.get(uri)
page.code.should eq 200
page.uri.to_s.should eq uri
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