From a4a6f5cd72dbe761a9e5ebef1a2261e1eec1ae0e Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Thu, 15 Jan 2026 16:17:21 +0000 Subject: [PATCH] CLDC-4114: Update tests --- ...tion_confirmation_banner_component_spec.rb | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/spec/components/data_protection_confirmation_banner_component_spec.rb b/spec/components/data_protection_confirmation_banner_component_spec.rb index fb687f25c..587a5c2c0 100644 --- a/spec/components/data_protection_confirmation_banner_component_spec.rb +++ b/spec/components/data_protection_confirmation_banner_component_spec.rb @@ -23,13 +23,18 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do organisation.users.where(is_dpo: true).destroy_all end - it "displays the banner" do - expect(component.display_banner?).to eq(true) - expect(render).to have_link( - "Contact helpdesk to assign a data protection officer", - href: "https://mhclgdigital.atlassian.net/servicedesk/customer/portal/6/group/11", - ) - expect(render).to have_selector("p", text: "To create logs your organisation must state a data protection officer. They must sign the Data Sharing Agreement.") + context "when org does not have a signed data sharing agreement" do + let(:organisation) { create(:organisation, :without_dpc) } + let(:user) { create(:user, organisation:, with_dsa: false) } + + it "displays the banner" do + expect(component.display_banner?).to eq(true) + expect(render).to have_link( + "Contact helpdesk to assign a data protection officer", + href: "https://mhclgdigital.atlassian.net/servicedesk/customer/portal/6/group/11", + ) + expect(render).to have_selector("p", text: "To create logs your organisation must state a data protection officer. They must sign the Data Sharing Agreement.") + end end end @@ -127,13 +132,9 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do organisation.users.where(is_dpo: true).destroy_all end - it "displays the banner" do - expect(component.display_banner?).to eq(true) - expect(render).to have_link( - "Contact helpdesk to assign a data protection officer", - href: "https://mhclgdigital.atlassian.net/servicedesk/customer/portal/6/group/11", - ) - expect(render).to have_selector("p", text: "To create logs your organisation must state a data protection officer. They must sign the Data Sharing Agreement.") + it "doesn't display the banner" do + expect(component.display_banner?).to eq(false) + expect(render.content).to be_empty end end