Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrillberg committed Mar 4, 2025
1 parent 1ada9bb commit d943951
Showing 1 changed file with 15 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@
end

context 'SimpleFormsApi::NotificationEmail initialization fails' do
it 'raises an error and increments statsd' do
allow(SimpleFormsApi::NotificationEmail).to receive(:new).and_raise(ArgumentError)
it 'increments statsd' do
allow(StatsD).to receive(:increment)

expect do
described_class.new.perform(
notification_type: :error,
form_submission_attempt:,
form_number:,
user_account:
)
end.to raise_error(ArgumentError)
described_class.new.perform(
notification_type: :error,
form_submission_attempt:,
form_number:,
user_account:
)

expect(StatsD).to have_received(:increment).with('silent_failure', tags: anything)
end
end
Expand All @@ -63,18 +61,16 @@
end

context 'SimpleFormsApi::FormUploadNotificationEmail initialization fails' do
it 'raises an error and increments statsd' do
it 'increments statsd' do
allow(SimpleFormsApi::FormUploadNotificationEmail).to receive(:new).and_raise(ArgumentError)
allow(StatsD).to receive(:increment)

expect do
described_class.new.perform(
notification_type: :error,
form_submission_attempt:,
form_number:,
user_account:
)
end.to raise_error(ArgumentError)
described_class.new.perform(
notification_type: :error,
form_submission_attempt:,
form_number:,
user_account:
)
expect(StatsD).to have_received(:increment).with('silent_failure', tags: anything)
end
end
Expand Down

0 comments on commit d943951

Please sign in to comment.