From 663e6dac5d99664f040c1869d62d714a8a16a112 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Wed, 9 Jun 2021 22:36:35 +0900 Subject: [PATCH] add query params test --- spec/mechanize_spec.cr | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/spec/mechanize_spec.cr b/spec/mechanize_spec.cr index 70ac063..a32718f 100644 --- a/spec/mechanize_spec.cr +++ b/spec/mechanize_spec.cr @@ -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