diff options
Diffstat (limited to 'spec/initializers/mailer_retries_spec.rb')
-rw-r--r-- | spec/initializers/mailer_retries_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/initializers/mailer_retries_spec.rb b/spec/initializers/mailer_retries_spec.rb new file mode 100644 index 00000000000..c1e56784ad9 --- /dev/null +++ b/spec/initializers/mailer_retries_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Mailer retries' do + # We need to ensure that this runs through Sidekiq to take + # advantage of the middleware. There is a Rails bug that means we + # have to do some extra steps to make this happen: + # https://github.com/rails/rails/issues/37270#issuecomment-553927324 + around do |example| + descendants = ActiveJob::Base.descendants + [ActiveJob::Base] + descendants.each(&:disable_test_adapter) + ActiveJob::Base.queue_adapter = :sidekiq + + example.run + + descendants.each { |a| a.queue_adapter = :test } + end + + it 'sets retries for mailers to 3', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/332645' do + DeviseMailer.user_admin_approval(create(:user)).deliver_later + + expect(Sidekiq::Queues['mailers'].first).to include('retry' => 3) + end +end |