From 2cdb9cf986ed3032b786f7ac63b02b777e0e17de Mon Sep 17 00:00:00 2001 From: Joshua Drumm <34111449+JoshingYou1@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:52:55 -0500 Subject: [PATCH] Added incrementor and updated tests --- lib/form1010_ezr/service.rb | 4 ++++ spec/lib/form1010_ezr/service_spec.rb | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/form1010_ezr/service.rb b/lib/form1010_ezr/service.rb index 2f6b459aeb3..76ba1609d8b 100644 --- a/lib/form1010_ezr/service.rb +++ b/lib/form1010_ezr/service.rb @@ -47,6 +47,10 @@ def submit_sync(parsed_form) veteran_initials: veteran_initials(parsed_form) ) + if parsed_form['attachments'].present? + StatsD.increment("#{Form1010Ezr::Service::STATSD_KEY_PREFIX}.submission_with_attachment") + end + res rescue => e log_and_raise_error(e, parsed_form) diff --git a/spec/lib/form1010_ezr/service_spec.rb b/spec/lib/form1010_ezr/service_spec.rb index 0b36a41c372..3d1478111a4 100644 --- a/spec/lib/form1010_ezr/service_spec.rb +++ b/spec/lib/form1010_ezr/service_spec.rb @@ -447,7 +447,10 @@ def expect_personal_info_log(message) let(:form) { get_fixture('form1010_ezr/valid_form') } context 'with pdf attachments' do - it 'returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:32 GMT' do + it 'increments StatsD and returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:32 GMT' do + allow(StatsD).to receive(:increment) + expect(StatsD).to receive(:increment).with("api.1010ezr.submission_with_attachment") + VCR.use_cassette( 'form1010_ezr/authorized_submit_with_attachments', { match_requests_on: %i[method uri body], erb: true } @@ -467,7 +470,10 @@ def expect_personal_info_log(message) end context 'with a non-pdf attachment' do - it 'returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:34 GMT' do + it 'increments StatsD and returns a success object', run_at: 'Wed, 17 Jul 2024 18:17:34 GMT' do + allow(StatsD).to receive(:increment) + expect(StatsD).to receive(:increment).with("api.1010ezr.submission_with_attachment") + VCR.use_cassette( 'form1010_ezr/authorized_submit_with_non_pdf_attachment', { match_requests_on: %i[method uri body], erb: true }