diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/initializers/mailer_retries_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
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 |