From 49ede2a73d683d84959098fb27179f04b9ab5ceb Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 26 May 2022 18:20:50 +0100 Subject: [PATCH] correct test and checking title without logs in DB --- app/views/case_logs/index.html.erb | 2 +- spec/requests/case_logs_controller_spec.rb | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index 588c1cf6a..9ae6fe206 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -3,7 +3,7 @@ <% if @searched.present? %> <% title = "Logs (search results for ‘#{@searched}’#{@pagy.count > 1 ? ", page #{@pagy.page} of #{@pagy.last}" : ''}) - Submit social housing and sales data (CORE) - GOV.UK" %> <% else %> - <% title = "Logs #{@pagy.count > 1 ? "(page #{@pagy.page} of #{@pagy.last})" : ''} - Submit social housing and sales data (CORE) - GOV.UK" %> + <% title = "Logs #{@pagy.count > 1 ? "(page #{@pagy.page} of #{@pagy.last}) " : ''}- Submit social housing and sales data (CORE) - GOV.UK" %> <% end %> <% content_for :title, title %> diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index 315ff6867..60c164c10 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -184,6 +184,17 @@ RSpec.describe CaseLogsController, type: :request do expect(page).to have_content("UA984") end + context "when there are no logs in the database" do + before do + CaseLog.destroy_all + end + + it "page has correct title" do + get "/logs", headers: headers, params: {} + expect(page).to have_title("Logs - Submit social housing and sales data (CORE) - GOV.UK") + end + end + context "when filtering" do context "with status filter" do let(:organisation_2) { FactoryBot.create(:organisation) } @@ -433,7 +444,7 @@ RSpec.describe CaseLogsController, type: :request do end it "does not have pagination in the title" do - expect(page).to have_title("Logs") + expect(page).to have_title("Logs - Submit social housing and sales data (CORE) - GOV.UK") end it "shows the download csv link" do