-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LG-5072: Add Start Over to additional steps in the IAL2 flow (#5394)
* Repurpose Idv::SessionsController#destroy for IAL2 restart **Why**: Because not all "Start Over" occurs is expected to occur within the FlowStateMachine (e.g. GPO verification, soon others). * Add "Start Over" link to IAL2 steps * Allow have_logged_event with absent attributes **Why**: Because sometimes events are logged without any attributes, and it's tedious / redundant to have to explicitly pass an empty hash, especially when the original call under test doesn't actually have to pass an empty hash. * Add Idv::SessionsController spec * Mock missing view values for IdV phone start_over_or_cancel uses cancel shared partial, which relies on specific values to determine whether user is signing up * Mock missing view values for IdV OTP delivery method * Support logging location params for SessionsController#destroy * Log "clear and start over" via step, location params * Opt-in verify_account view for ERB linting * Remove unused analytics constant * Remove unnecessary ERBLint exclusion It passes as-is * Remove more unnecessary ERBLint exclusions All passing * Add trailing comma to _start_over_or_cancel ERBLint * Pass step to start over link **Why**: It's already there!
- Loading branch information
Showing
19 changed files
with
148 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require 'rails_helper' | ||
|
||
describe Idv::SessionsController do | ||
let(:user) { build(:user) } | ||
|
||
before do | ||
stub_sign_in(user) | ||
stub_analytics | ||
end | ||
|
||
describe '#destroy' do | ||
let(:idv_session) { double } | ||
let(:flow_session) { {} } | ||
let(:pii) { { first_name: 'Jane' } } | ||
|
||
before do | ||
allow(idv_session).to receive(:clear) | ||
allow(subject).to receive(:idv_session).and_return(idv_session) | ||
controller.user_session['idv/doc_auth'] = flow_session | ||
controller.user_session[:decrypted_pii] = pii | ||
end | ||
|
||
it 'deletes idv session' do | ||
expect(idv_session).to receive(:clear) | ||
|
||
delete :destroy | ||
|
||
expect(controller.user_session['idv/doc_auth']).to be_blank | ||
expect(controller.user_session[:decrypted_pii]).to be_blank | ||
end | ||
|
||
it 'logs start over with step and location params' do | ||
delete :destroy, params: { step: 'first', location: 'get_help' } | ||
|
||
expect(@analytics).to have_logged_event( | ||
Analytics::IDV_START_OVER, | ||
step: 'first', | ||
location: 'get_help', | ||
) | ||
end | ||
|
||
it 'redirects to start of identity verificaton' do | ||
delete :destroy | ||
|
||
expect(response).to redirect_to(idv_url) | ||
end | ||
|
||
context 'pending profile' do | ||
let(:user) do | ||
create( | ||
:user, | ||
profiles: [create(:profile, deactivation_reason: :verification_pending)], | ||
) | ||
end | ||
|
||
it 'cancels verification attempt' do | ||
cancel = double | ||
expect(Idv::CancelVerificationAttempt).to receive(:new).and_return(cancel) | ||
expect(cancel).to receive(:call) | ||
|
||
delete :destroy, params: { step: 'gpo_verify', location: 'clear_and_start_over' } | ||
|
||
expect(@analytics).to have_logged_event( | ||
Analytics::IDV_START_OVER, | ||
step: 'gpo_verify', | ||
location: 'clear_and_start_over', | ||
) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters