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/controllers/idv/ssn_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def show

analytics.idv_doc_auth_ssn_visited(**analytics_arguments)

Funnel::DocAuth::RegisterStep.new(current_user.id, sp_session[:issuer]).
call('ssn', :view, true)

render :show, locals: extra_view_variables
end

Expand Down
4 changes: 4 additions & 0 deletions app/jobs/reports/daily_dropoffs_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class DailyDropoffsReport < BaseReport

attr_reader :report_date

def initialize(report_date = nil)
@report_date = report_date
end

def perform(report_date)
@report_date = report_date

Expand Down
10 changes: 9 additions & 1 deletion spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:flow_path => 'standard' }
end

let(:user) { build(:user, :with_phone, with: { phone: '+1 (415) 555-0130' }) }
let(:user) { create(:user) }

before do
allow(subject).to receive(:flow_session).and_return(flow_session)
Expand Down Expand Up @@ -68,6 +68,14 @@
expect(@analytics).to have_received(:track_event).with(analytics_name, analytics_args)
end

it 'updates DocAuthLog ssn_view_count' do
doc_auth_log = DocAuthLog.create(user_id: user.id)

expect { get :show }.to(
change { doc_auth_log.reload.ssn_view_count }.from(0).to(1),
)
end

context 'without a flow session' do
let(:flow_session) { nil }
it 'redirects to doc_auth' do
Expand Down
18 changes: 16 additions & 2 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rails_helper'
require 'csv'

feature 'Analytics Regression', js: true do
include IdvStepHelper
Expand Down Expand Up @@ -152,8 +153,21 @@
end

it 'records all of the events' do
happy_path_events.each do |event, attributes|
expect(fake_analytics).to have_logged_event(event, attributes)
aggregate_failures 'analytics events' do
happy_path_events.each do |event, attributes|
expect(fake_analytics).to have_logged_event(event, attributes)
end
end

aggregate_failures 'populates data for each step of the Daily Dropoff Report' do
row = CSV.parse(
Reports::DailyDropoffsReport.new(Time.zone.now).report_body,
headers: true,
).first

Reports::DailyDropoffsReport::STEPS.each do |step|
expect(row[step].to_i).to(be > 0, "step #{step} was counted")
end
end
end
end
Expand Down