diff --git a/spec/agent_spec.cr b/spec/agent_spec.cr index 7a966f8..42084b8 100644 --- a/spec/agent_spec.cr +++ b/spec/agent_spec.cr @@ -26,6 +26,18 @@ describe "Mechanize Agent test" do page.not_nil!.body.should eq "success" end + it "can fill and submit form with submit button" do + agent = Mechanize.new + page = agent.get("http://example.com/form") + form = page.forms[0] + form.field_with("name").value = "foo" + form.field_with("email").value = "bar" + submit_button = form.buttons[0] + page = agent.submit(form, submit_button) + page.not_nil!.code.should eq 200 + page.not_nil!.body.should eq "success with button" + end + it "can receive and send cookie" do agent = Mechanize.new # receive cookies diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index a0478f2..c6284af 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -18,7 +18,7 @@ WebMock.stub(:get, "example.com/form").to_return(body: