Skip to content

Commit

Permalink
Added incrementor and updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshingYou1 committed Nov 27, 2024
1 parent 3a1e551 commit 2cdb9cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/form1010_ezr/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions spec/lib/form1010_ezr/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check failure on line 452 in spec/lib/form1010_ezr/service_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

VCR.use_cassette(
'form1010_ezr/authorized_submit_with_attachments',
{ match_requests_on: %i[method uri body], erb: true }
Expand All @@ -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")

Check failure on line 475 in spec/lib/form1010_ezr/service_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

VCR.use_cassette(
'form1010_ezr/authorized_submit_with_non_pdf_attachment',
{ match_requests_on: %i[method uri body], erb: true }
Expand Down

0 comments on commit 2cdb9cf

Please sign in to comment.