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
3 changes: 3 additions & 0 deletions app/services/flow/flow_state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def analytics_properties
step: current_step,
step_count: current_flow_step_counts[current_step_name],
analytics_id: @analytics_id,
irs_reproofing: effective_user&.decorate&.reproof_for_irs?(
service_provider: current_sp,
).present?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is .present? necessary? Would reproof_from_irs? ever return anything other than true or false?

Suggested change
).present?,
),

Copy link
Contributor Author

@gsa-manish gsa-manish Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can return nil also.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, reproof_for_irs? wouldn't, but I see now that with the safe navigation it might be possible that effective_user could.

}
end

Expand Down
21 changes: 21 additions & 0 deletions spec/controllers/idv/capture_doc_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,32 @@
expect(response).to_not be_not_found
end

it 'tracks expected events for irs reproofing' do
allow_any_instance_of(UserDecorator).to receive(:reproof_for_irs?).and_return(true)
mock_next_step(:capture_complete)
result = {
step: 'capture_complete',
flow_path: 'hybrid',
irs_reproofing: true,
step_count: 1,
analytics_id: 'Doc Auth',
}

get :show, params: { step: 'capture_complete' }

expect(@irs_attempts_api_tracker).not_to have_received(:idv_phone_upload_link_used)

expect(@analytics).to have_received(:track_event).with(
'IdV: doc auth capture_complete visited', result
)
end

it 'tracks expected events' do
mock_next_step(:capture_complete)
result = {
step: 'capture_complete',
flow_path: 'hybrid',
irs_reproofing: false,
step_count: 1,
analytics_id: 'Doc Auth',
}
Expand Down
5 changes: 4 additions & 1 deletion spec/controllers/idv/doc_auth_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
end

it 'tracks analytics' do
result = { step: 'welcome', flow_path: 'standard', step_count: 1, analytics_id: 'Doc Auth' }
result = { step: 'welcome', flow_path: 'standard', irs_reproofing: false, step_count: 1,
analytics_id: 'Doc Auth' }

get :show, params: { step: 'welcome' }

Expand Down Expand Up @@ -164,6 +165,7 @@
flow_path: 'standard',
step_count: 1,
pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]],
irs_reproofing: false,
analytics_id: 'Doc Auth',
}

Expand Down Expand Up @@ -200,6 +202,7 @@
},
step: 'welcome',
flow_path: 'standard',
irs_reproofing: false,
step_count: 1,
analytics_id: 'Doc Auth',
}
Expand Down