diff --git a/app/controllers/saml_idp_controller.rb b/app/controllers/saml_idp_controller.rb index 096a6bcec22..fd577edbed9 100644 --- a/app/controllers/saml_idp_controller.rb +++ b/app/controllers/saml_idp_controller.rb @@ -105,6 +105,6 @@ def track_events analytics.track_event(Analytics::SP_REDIRECT_INITIATED) Db::SpReturnLog::AddReturn.call(request_id, current_user.id) increment_monthly_auth_count - add_sp_cost(sp_session[:ial2] ? :ial2_authentication : :ial1_authentication) + add_sp_cost(:authentication) end end diff --git a/spec/controllers/saml_idp_controller_spec.rb b/spec/controllers/saml_idp_controller_spec.rb index b6dc749d079..7af9c93b702 100644 --- a/spec/controllers/saml_idp_controller_spec.rb +++ b/spec/controllers/saml_idp_controller_spec.rb @@ -989,6 +989,8 @@ def stub_requested_attributes expect(@analytics).to receive(:track_event).with(Analytics::SP_REDIRECT_INITIATED) generate_saml_response(user) + + expect_sp_authentication_cost end end @@ -1014,6 +1016,8 @@ def stub_requested_attributes expect(@analytics).to receive(:track_event).with(Analytics::SP_REDIRECT_INITIATED) generate_saml_response(user) + + expect_sp_authentication_cost end end end @@ -1029,4 +1033,10 @@ def stub_requested_attributes ) end end + + def expect_sp_authentication_cost + sp_cost = SpCost.where(issuer: 'http://localhost:3000', + cost_type: 'authentication').first + expect(sp_cost).to be_present + end end