Skip to content

Commit

Permalink
Restore emails size checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Feb 19, 2024
1 parent 1ec1701 commit a769d54
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/controllers/admin/disputes/appeals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
expect(target_account.reload)
.to_not be_suspended

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(target_account.user.email),
Expand All @@ -62,6 +64,9 @@
expect(response)
.to redirect_to(disputes_strike_path(appeal.strike))

expect(emails.size)
.to eq(1)

expect(emails.first)
.to have_attributes(
to: contain_exactly(target_account.user.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/admin/resets_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
it 'redirects to admin accounts page' do
emails = capture_emails { subject }

expect(emails.size)
.to eq(2)
expect(emails).to have_attributes(
first: have_attributes(
to: include(account.user.email),
Expand Down
4 changes: 4 additions & 0 deletions spec/controllers/auth/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
expect(controller.current_user)
.to eq user

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(user.email),
Expand Down Expand Up @@ -276,6 +278,8 @@
expect(flash[:alert])
.to match I18n.t('users.rate_limited')

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(user.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/disputes/appeals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
it 'notifies staff about new appeal and redirects back to strike page', :sidekiq_inline do
emails = capture_emails { subject }

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(admin.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@
emails = capture_emails { subject }

expect(user.confirmed_at).to be_present
expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(user.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/requests/api/v1/reports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
expect(target_account.targeted_reports).to_not be_empty
expect(target_account.targeted_reports.first.comment).to eq 'reasons'

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(admin.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/services/notify_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@
it 'sends email', :sidekiq_inline do
emails = capture_emails { subject }

expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(user.email),
Expand Down
2 changes: 2 additions & 0 deletions spec/workers/backup_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

expect(service).to have_received(:call).with(backup)
expect { other_backup.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect(emails.size)
.to eq(1)
expect(emails.first)
.to have_attributes(
to: contain_exactly(backup.user.email),
Expand Down

0 comments on commit a769d54

Please sign in to comment.