2019-10-21 09:06:22 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2016-04-04 15:23:43 +00:00
|
|
|
|
2016-04-06 11:47:05 +00:00
|
|
|
describe RepositoryCheckMailer do
|
2016-04-04 15:23:43 +00:00
|
|
|
include EmailSpec::Matchers
|
|
|
|
|
|
|
|
describe '.notify' do
|
|
|
|
it 'emails all admins' do
|
2016-04-14 15:05:41 +00:00
|
|
|
admins = create_list(:admin, 3)
|
2016-04-04 15:23:43 +00:00
|
|
|
|
|
|
|
mail = described_class.notify(1)
|
|
|
|
|
|
|
|
expect(mail).to deliver_to admins.map(&:email)
|
|
|
|
end
|
|
|
|
|
2019-06-11 20:44:45 +00:00
|
|
|
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-04-04 15:23:43 +00:00
|
|
|
it 'mentions the number of failed checks' do
|
|
|
|
mail = described_class.notify(3)
|
|
|
|
|
2016-04-18 08:58:40 +00:00
|
|
|
expect(mail).to have_subject 'GitLab Admin | 3 projects failed their last repository check'
|
2016-04-04 15:23:43 +00:00
|
|
|
end
|
2019-02-20 15:18:15 +00:00
|
|
|
|
|
|
|
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-04-04 15:23:43 +00:00
|
|
|
end
|
|
|
|
end
|