debian-mirror-gitlab/spec/initializers/mailer_retries_spec.rb
2021-09-04 02:52:04 +05:30

25 lines
853 B
Ruby

# 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