diff --git a/lib/capybara/node/simple.rb b/lib/capybara/node/simple.rb index e70b06db..326c2928 100644 --- a/lib/capybara/node/simple.rb +++ b/lib/capybara/node/simple.rb @@ -152,12 +152,7 @@ module Capybara # # @return [String] The title of the document def title - if native.respond_to? :title - native.title - else - #old versions of nokogiri don't have #title - remove in 3.0 - native.xpath('/html/head/title | /html/title').first.text - end + native.title end def inspect diff --git a/lib/capybara/rack_test/browser.rb b/lib/capybara/rack_test/browser.rb index 65fb0a24..f0bc57b0 100644 --- a/lib/capybara/rack_test/browser.rb +++ b/lib/capybara/rack_test/browser.rb @@ -105,12 +105,7 @@ class Capybara::RackTest::Browser end def title - if dom.respond_to? :title - dom.title - else - #old versions of nokogiri don't have #title - remove in 3.0 - dom.xpath('/html/head/title | /html/title').first.text - end + dom.title end protected diff --git a/lib/capybara/spec/session/current_url_spec.rb b/lib/capybara/spec/session/current_url_spec.rb index e0e56520..6b0dfb0e 100644 --- a/lib/capybara/spec/session/current_url_spec.rb +++ b/lib/capybara/spec/session/current_url_spec.rb @@ -14,11 +14,11 @@ Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do end def should_be_on server_index, path="/host", scheme="http" - #This delay is to give fully async drivers (selenium w/chromedriver) time for the browser - #to get to its destination - should be removed when we have a waiting current_url matcher - sleep 0.1 # remove and adjust tests when a waiting current_url/path matcher is implemented # Check that we are on /host on the given server s = @servers[server_index] + + expect(@session).to have_current_path("#{scheme}://#{s.host}:#{s.port}#{path}", url: true) + expect(@session.current_url.chomp('?')).to eq("#{scheme}://#{s.host}:#{s.port}#{path}") expect(@session.current_host).to eq("#{scheme}://#{s.host}") # no port expect(@session.current_path).to eq(path)