From b52aabdb830768cf495552dbe426cffbd91e87d3 Mon Sep 17 00:00:00 2001 From: John Bramley <20125855+bramleyjl@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:40:00 -0700 Subject: [PATCH] updates SiS controller spec --- .../controllers/v0/sign_in_controller_spec.rb | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/spec/controllers/v0/sign_in_controller_spec.rb b/spec/controllers/v0/sign_in_controller_spec.rb index 43e4243a925..7524f1922d8 100644 --- a/spec/controllers/v0/sign_in_controller_spec.rb +++ b/spec/controllers/v0/sign_in_controller_spec.rb @@ -2263,8 +2263,19 @@ let(:enforced_terms) { nil } let(:anti_csrf) { false } let(:expected_error_status) { :unauthorized } + let(:identifier) { user_account.icn } + let(:deceased_date) { nil } + let(:id_theft_flag) { false } + let(:mpi_profile) { build(:mpi_profile, icn: user_account.icn, deceased_date:, id_theft_flag:) } + let(:find_profile_response) { create(:find_profile_response, profile: mpi_profile) } - before { allow(Rails.logger).to receive(:info) } + before do + allow(Rails.logger).to receive(:info) + allow_any_instance_of(MPI::Service) + .to receive(:find_profile_by_identifier) + .with(identifier:, identifier_type: MPI::Constants::ICN) + .and_return(find_profile_response) + end shared_examples 'error response' do let(:expected_error_json) { { 'errors' => expected_error } } @@ -2432,6 +2443,20 @@ it_behaves_like 'error response' end + context 'and the retrieved account has an MPI death flag' do + let(:deceased_date) { '20020202' } + let(:expected_error) { 'Death Flag Detected' } + + it_behaves_like 'error response' + end + + context 'and the account has an MPI theft flag' do + let(:id_theft_flag) { true } + let(:expected_error) { 'Theft Flag Detected' } + + it_behaves_like 'error response' + end + it 'returns ok status' do expect(subject).to have_http_status(:ok) end