Permalink
Browse files

Add missing spec that shows a regression after e3bcf5.

  • Loading branch information...
djanowski committed Apr 13, 2010
1 parent 2a6c67b commit 2c9de38129aeaab666bf2040566f1ade0c90b2ae
Showing with 25 additions and 1 deletion.
  1. +16 −0 spec/integration/mechanize/sample_app.rb
  2. +9 −1 spec/integration/mechanize/spec/mechanize_spec.rb
@@ -16,4 +16,20 @@ class SampleApp < Sinatra::Default
get "/redirected" do
"Redirected"
end
+
+ get "/form" do
+ <<-EOS
+ <html>
+ <form action="/form" method="post">
+ <input type="hidden" name="_method" value="put" />
+ <label for="email">Email:</label> <input type="text" id="email" name="email" /></label>
+ <input type="submit" value="Add" />
+ </form>
+ </html>
+ EOS
+ end
+
+ put "/form" do
+ "Welcome #{params[:email]}"
+ end
end
@@ -12,7 +12,15 @@
end
it "should follow links"
- it "should submit forms"
+
+ it "should submit forms" do
+ visit "http://localhost:9292/form"
+ fill_in "Email", :with => "albert@example.com"
+ click_button "Add"
+
+ response.should contain("Welcome albert@example.com")
+ end
+
it "should not follow external redirects" do
pending do
response = visit("http://localhost:9292/external_redirect")

0 comments on commit 2c9de38

Please sign in to comment.