|
42 | 42 | describe '#notify' do
|
43 | 43 | subject(:notify) { described_class.new.notify(params) }
|
44 | 44 |
|
| 45 | + let(:tags) { ["params:#{params}", "claim_id:#{claim.id}"] } |
| 46 | + |
| 47 | + before { allow(StatsD).to receive(:increment) } |
| 48 | + |
45 | 49 | context 'retry_count is 0' do
|
46 |
| - let(:params) { { 'retry_count' => 0 } } |
| 50 | + let(:params) { { 'retry_count' => 0, 'args' => [claim.id] } } |
47 | 51 |
|
48 | 52 | it 'increments applications_retried statsd' do
|
49 |
| - expect { notify }.to trigger_statsd_increment('api.form1010cg.async.applications_retried') |
| 53 | + expect(StatsD).to receive(:increment).with('api.form1010cg.async.applications_retried') |
| 54 | + notify |
50 | 55 | end
|
51 | 56 | end
|
52 | 57 |
|
53 | 58 | context 'retry_count is not 0 or 9' do
|
54 |
| - let(:params) { { 'retry_count' => 5 } } |
| 59 | + let(:params) { { 'retry_count' => 5, 'args' => [claim.id] } } |
55 | 60 |
|
56 | 61 | it 'does not increment applications_retried statsd' do
|
57 |
| - expect { notify }.not_to trigger_statsd_increment('api.form1010cg.async.applications_retried') |
| 62 | + expect(StatsD).not_to receive(:increment).with('api.form1010cg.async.applications_retried') |
| 63 | + notify |
58 | 64 | end
|
59 | 65 |
|
60 | 66 | it 'does not increment failed_ten_retries statsd' do
|
61 |
| - expect do |
62 |
| - notify |
63 |
| - end.not_to trigger_statsd_increment('api.form1010cg.async.failed_ten_retries', tags: ["params:#{params}"]) |
| 67 | + expect(StatsD).not_to receive(:increment).with('api.form1010cg.async.failed_ten_retries', tags:) |
| 68 | + notify |
64 | 69 | end
|
65 | 70 | end
|
66 | 71 |
|
67 | 72 | context 'retry_count is 9' do
|
68 |
| - let(:params) { { 'retry_count' => 9 } } |
| 73 | + let(:params) { { 'retry_count' => 9, 'args' => [claim.id] } } |
69 | 74 |
|
70 | 75 | it 'increments failed_ten_retries statsd' do
|
71 |
| - expect do |
72 |
| - notify |
73 |
| - end.to trigger_statsd_increment('api.form1010cg.async.failed_ten_retries', tags: ["params:#{params}"]) |
| 76 | + expect(StatsD).to receive(:increment).with('api.form1010cg.async.failed_ten_retries', tags:) |
| 77 | + notify |
74 | 78 | end
|
75 | 79 | end
|
76 | 80 | end
|
|
129 | 133 |
|
130 | 134 | expect(VANotify::EmailJob).to receive(:perform_async).with(*template_params)
|
131 | 135 | expect(StatsD).to receive(:increment).with(
|
132 |
| - "#{statsd_key_prefix}submission_failure_email_sent" |
| 136 | + "#{statsd_key_prefix}submission_failure_email_sent", tags: ["claim_id:#{claim.id}"] |
133 | 137 | )
|
134 | 138 | end
|
135 | 139 | end
|
|
173 | 177 |
|
174 | 178 | expect(VANotify::EmailJob).to receive(:perform_async)
|
175 | 179 | expect(StatsD).to receive(:increment).with(
|
176 |
| - "#{statsd_key_prefix}submission_failure_email_sent" |
| 180 | + "#{statsd_key_prefix}submission_failure_email_sent", tags: ["claim_id:#{claim.id}"] |
177 | 181 | )
|
178 | 182 | expect(StatsD).to receive(:increment).with(
|
179 | 183 | "#{statsd_key_prefix}record_parse_error",
|
|
0 commit comments