From bf2106d8640598109fa821ebd020d1edd6e5f78d Mon Sep 17 00:00:00 2001 From: Wyatt Kirby Date: Fri, 11 Oct 2024 15:50:24 -0400 Subject: [PATCH] Add spec for bug --- spec/phi_attrs/phi_record/instance__allow_phi_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/phi_attrs/phi_record/instance__allow_phi_spec.rb b/spec/phi_attrs/phi_record/instance__allow_phi_spec.rb index 900c1d4..6e052de 100644 --- a/spec/phi_attrs/phi_record/instance__allow_phi_spec.rb +++ b/spec/phi_attrs/phi_record/instance__allow_phi_spec.rb @@ -124,6 +124,17 @@ it 'get_phi with block returns value' do |t| expect(patient_jane.get_phi(file_name, t.full_description) { patient_jane.first_name }).to eq('Jane') end + + it 'does not leak phi allowance if get_phi returns' do |t| + def name_getter + patient_jane.get_phi(file_name, t.full_description) { return patient_jane.first_name } + end + + expect(patient_jane.phi_allowed?).to be false + first_name = name_getter + expect(first_name).to eq('Jane') + expect(patient_jane.phi_allowed?).to be false + end end context 'collection' do