diff --git a/History.txt b/History.txt index 970691dd..1b2a76b5 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * Test suite now passes on Ruby 1.8 [Jo Liss] * #565: `require 'capybara/dsl'` is no longer necessary [Jo Liss] +* Rack::Test now respects ports when changing hosts [Jo Liss] ### Added diff --git a/lib/capybara/rack_test/browser.rb b/lib/capybara/rack_test/browser.rb index b46de045..9c75262e 100644 --- a/lib/capybara/rack_test/browser.rb +++ b/lib/capybara/rack_test/browser.rb @@ -48,6 +48,9 @@ class Capybara::RackTest::Browser if new_uri.host @current_host = new_uri.scheme + '://' + new_uri.host + if new_uri.port != 80 + @current_host << ":#{new_uri.port}" + end end if new_uri.relative? diff --git a/lib/capybara/spec/session/current_url_spec.rb b/lib/capybara/spec/session/current_url_spec.rb index 9b1606b7..86468f21 100644 --- a/lib/capybara/spec/session/current_url_spec.rb +++ b/lib/capybara/spec/session/current_url_spec.rb @@ -52,7 +52,6 @@ shared_examples_for "current_url" do end it "is unaffected by following a relative link" do - pending 'reverts to port 80' visit_host_links @session.click_link("Relative Host") should_be_on 0 @@ -65,7 +64,6 @@ shared_examples_for "current_url" do end it "is unaffected by posting through a relative form" do - pending 'reverts to port 80' visit_host_links @session.click_button("Relative Host") should_be_on 0