Merge pull request #614 from joliss/query-string-test-problem

Strip empty query string in current_url test
This commit is contained in:
Jo Liss 2012-01-12 09:45:31 -08:00
commit 08b91f1222
3 changed files with 3 additions and 7 deletions

View File

@ -14,7 +14,7 @@ shared_examples_for "current_url" do
def should_be_on server_index, path="/host", scheme="http"
# Check that we are on /host on the given server
s = @servers[server_index]
@session.current_url.should == "#{scheme}://#{s.host}:#{s.port}#{path}"
@session.current_url.chomp('?').should == "#{scheme}://#{s.host}:#{s.port}#{path}"
@session.current_host.should == "#{scheme}://#{s.host}" # no port
@session.current_path.should == path
if path == '/host'

View File

@ -40,10 +40,6 @@ 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" method="post">
<form action="/host">
<p><input type="submit" value="Relative Host"/></p>
</form>
<form action="<%= params[:absolute_host] %>/host" method="post">
<form action="<%= params[:absolute_host] %>/host">
<p><input type="submit" value="Absolute Host"/></p>
</form>