From 0fbe748eef1b67953c94724ab40598a33c95d2c4 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 31 Mar 2022 10:37:25 +0100 Subject: [PATCH] More logs context --- spec/requests/case_logs_controller_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index c3662a6f9..b11586f7d 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -267,6 +267,23 @@ RSpec.describe CaseLogsController, type: :request do it "shows the log's status" do expect(CGI.unescape_html(response.body)).to include(case_log.status.humanize) end + + it "shows the total log count" do + expect(CGI.unescape_html(response.body)).to match("1 total logs") + end + + context "when there are more than 20 logs" do + before do + 25.times do + FactoryBot.create(:case_log, owning_organisation: organisation, managing_organisation: organisation,) + end + get "/logs", headers: headers, params: {} + end + + it "shows the total log count" do + expect(CGI.unescape_html(response.body)).to match("26 total logs") + end + end end context "when requesting a specific case log" do