diff --git a/spec/integration/mechanize/spec/mechanize_spec.rb b/spec/integration/mechanize/spec/mechanize_spec.r index 0c21da3..1228d56 100644 --- a/spec/integration/mechanize/spec/mechanize_spec.rb +++ b/spec/integration/mechanize/spec/mechanize_spec.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + "/spec_helper" describe "Webrat's Mechanize mode" do - it "should work" do + it "should handle get" do response = visit("http://localhost:9292/") response.should contain("Hello World") end @@ -11,6 +11,45 @@ describe "Webrat's Mechanize mode" do response.should contain("Redirected") end + it "should handle post" do + response = visit("http://localhost:9292/do_post", :post, :data1 => "new data", :data2 => 'more data') + response.code.should == "200" + response.should contain("resource created with: new data, more data") + end + + + it "should handle put" do + response = visit("http://localhost:9292/do_put", :put, :data => "new data") + response.code.should == "200" + response.should contain("resource updated with: new data") + end + + it "should handle delete" do + response = visit("http://localhost:9292/do_delete", :delete) + response.code.should == "200" + response.should contain("resource deleted") + end + + it "should handle 412 on get" do + response = visit("http://localhost:9292/not_allowed") + response.code.should == "412" + end + + it "should handle 412 on put" do + response = visit("http://localhost:9292/not_allowed", :put) + response.code.should == "412" + end + + it "should handle 412 on delete" do + response = visit("http://localhost:9292/not_allowed", :delete) + response.code.should == "412" + end + + it "should handle 412 on post" do + response = visit("http://localhost:9292/not_allowed", :post) + response.code.should == "412" + end + it "should follow links" it "should submit forms" it "should not follow external redirects" do