Use method="post".

WebKit will append a '?' to the URL when submitting a form via GET, even
if there is no actual form data. (Firefox does not.) This causes a couple
of tests to fail for the Poltergeist driver, because the tests do not
expect there to be a '?'. Presumably it would also affect
capybara-webkit.

I am not sure which behaviour is 'correct' but it would seem a bad idea
to mess with the URL that the browser is actually providing, so changing
to test like this just allows the results to be consistent.
This commit is contained in:
Jon Leighton 2012-01-12 16:26:25 +00:00
parent 7b5682e272
commit 3f2e0288ca
2 changed files with 6 additions and 2 deletions

View File

@ -40,6 +40,10 @@ class TestApp < Sinatra::Base
"Current host is #{request.scheme}://#{request.host}:#{request.port}"
end
post '/host' do
"Current host is #{request.scheme}://#{request.host}:#{request.port}"
end
get '/redirect/:times/times' do
times = params[:times].to_i
if times.zero?

View File

@ -3,10 +3,10 @@
<a href="<%= params[:absolute_host] %>/host">Absolute Host</a>
</p>
<form action="/host">
<form action="/host" method="post">
<p><input type="submit" value="Relative Host"/></p>
</form>
<form action="<%= params[:absolute_host] %>/host">
<form action="<%= params[:absolute_host] %>/host" method="post">
<p><input type="submit" value="Absolute Host"/></p>
</form>