From ae2becd0258f7bb7489a4d122241712d45d5cb20 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Thu, 28 May 2015 10:51:23 -0700 Subject: [PATCH] fix for issue #1524 --- lib/capybara/node/simple.rb | 2 +- lib/capybara/rack_test/browser.rb | 2 +- lib/capybara/spec/session/title_spec.rb | 4 ++-- lib/capybara/spec/views/with_title.erb | 5 ++++- spec/basic_node_spec.rb | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/capybara/node/simple.rb b/lib/capybara/node/simple.rb index 2a97b813..4197ac1b 100644 --- a/lib/capybara/node/simple.rb +++ b/lib/capybara/node/simple.rb @@ -146,7 +146,7 @@ module Capybara end def title - native.xpath("//title").first.text + native.title end def inspect diff --git a/lib/capybara/rack_test/browser.rb b/lib/capybara/rack_test/browser.rb index 3c6ba8d9..a26c3c23 100644 --- a/lib/capybara/rack_test/browser.rb +++ b/lib/capybara/rack_test/browser.rb @@ -96,7 +96,7 @@ class Capybara::RackTest::Browser end def title - dom.xpath("//title").text + dom.title end protected diff --git a/lib/capybara/spec/session/title_spec.rb b/lib/capybara/spec/session/title_spec.rb index 951587dc..cfb7d61c 100644 --- a/lib/capybara/spec/session/title_spec.rb +++ b/lib/capybara/spec/session/title_spec.rb @@ -1,13 +1,13 @@ Capybara::SpecHelper.spec '#title' do - it "should print the title of the page" do + it "should get the title of the page" do @session.visit('/with_title') expect(@session.title).to eq('Test Title') end context "with css as default selector" do before { Capybara.default_selector = :css } - it "should print the title of the page" do + it "should get the title of the page" do @session.visit('/with_title') expect(@session.title).to eq('Test Title') end diff --git a/lib/capybara/spec/views/with_title.erb b/lib/capybara/spec/views/with_title.erb index 6b64b921..770ca26f 100644 --- a/lib/capybara/spec/views/with_title.erb +++ b/lib/capybara/spec/views/with_title.erb @@ -1 +1,4 @@ -Test Title \ No newline at end of file +Test Title + + abcdefg + \ No newline at end of file diff --git a/spec/basic_node_spec.rb b/spec/basic_node_spec.rb index 878b82d4..590e2d49 100644 --- a/spec/basic_node_spec.rb +++ b/spec/basic_node_spec.rb @@ -9,6 +9,7 @@ RSpec.describe Capybara do simple_node + not document title

Totally awesome