debian-mirror-gitlab/spec/mailers/repository_check_mailer_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.3 KiB
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2016-06-02 11:05:42 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe RepositoryCheckMailer do
2016-06-02 11:05:42 +05:30
include EmailSpec::Matchers
describe '.notify' do
it 'emails all admins' do
admins = create_list(:admin, 3)
mail = described_class.notify(1)
expect(mail).to deliver_to admins.map(&:email)
end
2022-10-11 01:57:18 +05:30
it 'email with I18n.default_locale' do
admins = [create(:admin, preferred_language: :zh_CN), create(:admin, preferred_language: :zh_CN)]
mail = described_class.notify(3)
expect(mail).to deliver_to admins.map(&:email)
expect(mail).to have_subject 'GitLab Admin | 3 projects failed their last repository check'
end
2019-09-04 21:01:54 +05:30
it 'omits blocked admins' do
blocked = create(:admin, :blocked)
admins = create_list(:admin, 3)
mail = described_class.notify(1)
expect(mail.to).not_to include(blocked.email)
expect(mail).to deliver_to admins.map(&:email)
end
2016-06-02 11:05:42 +05:30
it 'mentions the number of failed checks' do
mail = described_class.notify(3)
expect(mail).to have_subject 'GitLab Admin | 3 projects failed their last repository check'
end
2019-07-07 11:18:12 +05:30
context 'with footer and header' do
subject { described_class.notify(1) }
it_behaves_like 'appearance header and footer enabled'
it_behaves_like 'appearance header and footer not enabled'
end
2016-06-02 11:05:42 +05:30
end
end