From 64711652e39b1409e47f489d5da7bdc6ad6a48b5 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 25 May 2022 11:58:24 +0100 Subject: [PATCH] Spec page title --- spec/requests/organisations_controller_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 4ccf0c729..74c1fe6b6 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -501,6 +501,10 @@ RSpec.describe OrganisationsController, type: :request do expect(page).to have_content("1 organisation found matching ‘#{search_param}’ of 29 total organisations.") end + it "has search in the title" do + expect(page).to have_title("Organisations (1 organisation matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK") + end + context "when the search term matches more than 1 result" do let(:search_param) { "name" } @@ -512,6 +516,18 @@ RSpec.describe OrganisationsController, type: :request do it "updates the table caption" do expect(page).to have_content("2 organisations found matching ‘#{search_param}’ of 29 total organisations.") end + + it "has search in the title" do + expect(page).to have_title("Organisations (2 organisations matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK") + end + end + + context "when search results require pagination" do + let(:search_param) { "DLUHC" } + + it "has search and pagination in the title" do + expect(page).to have_title("Organisations (27 organisations matching ‘#{search_param}’ of 29 total organisations) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + end end end end