From 4b03f71e05badf001612b2d5ee20574408a6b329 Mon Sep 17 00:00:00 2001 From: Thomas Tasler Date: Mon, 8 Jul 2019 19:01:54 +0200 Subject: [PATCH] fix 'the window should be titled' step - closes: #102 --- lib/spreewald/web_steps.rb | 6 +++++- tests/shared/app/views/layouts/application.html.haml | 2 ++ tests/shared/features/shared/web_steps.feature | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/spreewald/web_steps.rb b/lib/spreewald/web_steps.rb index e75259e..cb5758d 100644 --- a/lib/spreewald/web_steps.rb +++ b/lib/spreewald/web_steps.rb @@ -504,7 +504,11 @@ Then /^the window should be titled "([^"]*)"$/ do |title| patiently do - expect(page).to have_css('title', :text => title) + if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1") + expect(page).to have_selector("title", :content => title) + else + expect(page).to have_title(title) + end end end.overridable diff --git a/tests/shared/app/views/layouts/application.html.haml b/tests/shared/app/views/layouts/application.html.haml index dbb459d..a43ec07 100644 --- a/tests/shared/app/views/layouts/application.html.haml +++ b/tests/shared/app/views/layouts/application.html.haml @@ -1,5 +1,7 @@ !!! %html %head + %title + = "spreewald test application" %body = yield diff --git a/tests/shared/features/shared/web_steps.feature b/tests/shared/features/shared/web_steps.feature index 15fc00d..d6d7772 100644 --- a/tests/shared/features/shared/web_steps.feature +++ b/tests/shared/features/shared/web_steps.feature @@ -293,3 +293,8 @@ Feature: Web steps And the "Disabled field #3" field should be disabled But the "Enabled field #1" field should not be disabled And the "Enabled field #2" field should not be disabled + + + Scenario: /^the window should be titled "([^"]*)"$/ + When I go to "/static_pages/home" + Then the window should be titled "spreewald test application"