diff --git a/app/components/app_patient_card_component.rb b/app/components/app_patient_card_component.rb index e5fcb61c0..0e26664eb 100644 --- a/app/components/app_patient_card_component.rb +++ b/app/components/app_patient_card_component.rb @@ -4,6 +4,26 @@ class AppPatientCardComponent < ViewComponent::Base erb_template <<-ERB <%= render AppCardComponent.new do |card| %> <% card.with_heading { "Child record" } %> + + <% if Flipper.enabled?(:"v1.2.0") %> + <% if @patient.date_of_death.present? %> + <%= render AppNoticeStatusComponent.new( + text: "Record updated with child’s date of death" + ) %> + <% end %> + + <% if @patient.invalidated? %> + <%= render AppNoticeStatusComponent.new( + text: "Record flagged as invalid" + ) %> + <% end %> + + <% if @patient.restricted? %> + <%= render AppNoticeStatusComponent.new( + text: "Record flagged as sensitive" + ) %> + <% end %> + <% end %> <%= render AppPatientSummaryComponent.new( patient, diff --git a/spec/components/app_patient_card_component_spec.rb b/spec/components/app_patient_card_component_spec.rb index b5c33edea..e5d1c5ddd 100644 --- a/spec/components/app_patient_card_component_spec.rb +++ b/spec/components/app_patient_card_component_spec.rb @@ -12,4 +12,53 @@ it { should have_content("Full name") } it { should have_content("Date of birth") } it { should have_content("Address") } + + context "with a deceased patient" do + let(:patient) { create(:patient, :deceased) } + + context "with feature flag enabled" do + before { Flipper.enable(:"v1.2.0") } + after { Flipper.enable(:"v1.2.0") } + + it { should have_content("Record updated with child’s date of death") } + end + + context "without feature flag enabled" do + it do + expect(rendered).not_to have_content( + "Record updated with child’s date of death" + ) + end + end + end + + context "with an invalidated patient" do + let(:patient) { create(:patient, :invalidated) } + + context "with feature flag enabled" do + before { Flipper.enable(:"v1.2.0") } + after { Flipper.enable(:"v1.2.0") } + + it { should have_content("Record flagged as invalid") } + end + + context "without feature flag enabled" do + it { should_not have_content("Record flagged as invalid") } + end + end + + context "with a restricted patient" do + let(:patient) { create(:patient, :restricted) } + + context "with feature flag enabled" do + before { Flipper.enable(:"v1.2.0") } + after { Flipper.enable(:"v1.2.0") } + + it { should have_content("Record flagged as sensitive") } + end + + context "without feature flag enabled" do + it { should_not have_content("Record flagged as sensitive") } + end + end end