Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Deliver the signup confirmation mail on the test adapter in its spec

Guido Boyke19c8ec06166a
diff --git a/spec/requests/api/provisioning/v1/signups_spec.rb b/spec/requests/api/provisioning/v1/signups_spec.rb
index 7ccaffc..845bc57 100644
--- a/spec/requests/api/provisioning/v1/signups_spec.rb
+++ b/spec/requests/api/provisioning/v1/signups_spec.rb
@@ -136,8 +136,11 @@ RSpec.describe 'POST /api/provisioning/v1/signups' do
.to eq(User.find_by!(email: signup[:email]))
end
+ # The mail goes out through deliver_later, and the test environment runs Active Job on
+ # Solid Queue: with_delivered_mails sets the test adapter for the block. A bare
+ # perform_enqueued_jobs passed only when an earlier spec had left that adapter behind.
it 'sends the confirmation mail in the language the visitor signed up in' do
- perform_enqueued_jobs { post_signup(payload: signup.merge(language: 'de')) }
+ with_delivered_mails { post_signup(payload: signup.merge(language: 'de')) }
expect(ActionMailer::Base.deliveries.last.subject).to eq(
I18n.t('devise.mailer.confirmation_instructions.subject', locale: :de)