Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/presenters/account_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def pending_idv?
end

def pending_ipp?
user.pending_in_person_enrollment.present?
!!user.pending_profile&.in_person_verification_pending?
end

def pending_gpo?
user.gpo_verification_pending_profile?
!!user.pending_profile&.gpo_verification_pending?
end

def show_idv_partial?
Expand Down
42 changes: 42 additions & 0 deletions spec/presenters/account_show_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@

it { is_expected.to eq(true) }
end

context 'when current user has ipp pending profile deactivated for password reset' do
let(:user) { create(:user, :with_pending_in_person_enrollment) }

before do
user.profiles.first.update!(deactivation_reason: :password_reset)
end

it 'is expected to return false' do
account_show = AccountShowPresenter.new(
decrypted_pii: {},
sp_session_request_url: nil,
authn_context: nil,
sp_name: nil,
user: user,
locked_for_session: false,
)

expect(account_show.pending_ipp?).to be(false)
end
end
end

context '#pending_gpo?' do
Expand All @@ -169,6 +190,27 @@

it { is_expected.to eq(true) }
end

context 'when current user has gpo pending profile deactivated for password reset' do
let(:user) { create(:user, :with_pending_gpo_profile) }

before do
user.profiles.first.update!(deactivation_reason: :password_reset)
end

it 'is expected to return false' do
account_show = AccountShowPresenter.new(
decrypted_pii: {},
sp_session_request_url: nil,
authn_context: nil,
sp_name: nil,
user: user,
locked_for_session: false,
)

expect(account_show.pending_ipp?).to be(false)
end
end
end

context '#show_idv_partial?' do
Expand Down
28 changes: 27 additions & 1 deletion spec/views/accounts/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
RSpec.describe 'accounts/show.html.erb' do
let(:authn_context) { Vot::Parser::Result.no_sp_result }
let(:user) { create(:user, :fully_registered, :with_personal_key) }

let(:vtr) { ['C2'] }
let(:authn_context) do
AuthnContextResolver.new(
user:,
service_provider: nil,
vtr: vtr,
acr_values: nil,
).result
end
before do
allow(view).to receive(:current_user).and_return(user)
allow(view).to receive(:user_session).and_return({})
Expand Down Expand Up @@ -77,6 +85,15 @@
end
end

context 'when current user has gpo pending profile deactivated for password reset' do
let(:user) { create(:user, :with_pending_gpo_profile) }

it 'does not render idv partial' do
user.profiles.first.update!(deactivation_reason: :password_reset)
expect(render).to_not render_template(partial: 'accounts/_identity_verification')
end
end

context 'when current user has ipp pending profile' do
let(:user) { build(:user, :with_pending_in_person_enrollment) }

Expand All @@ -85,6 +102,15 @@
end
end

context 'when current user has ipp pending profile deactivated for password reset' do
let(:user) { create(:user, :with_pending_in_person_enrollment) }

it 'does not render idv partial' do
user.profiles.first.update!(deactivation_reason: :password_reset)
expect(render).to_not render_template(partial: 'accounts/_identity_verification')
end
end

context 'phone listing and adding' do
context 'user has no phone' do
let(:user) do
Expand Down