Skip to content

Commit

Permalink
updates SiS controller spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bramleyjl committed Dec 5, 2024
1 parent d45b63d commit b52aabd
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion spec/controllers/v0/sign_in_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 } }
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b52aabd

Please sign in to comment.