repository_check_mailer_spec.rb 489 Bytes
Newer Older
Jacob Vosmaer's avatar
Jacob Vosmaer committed
1 2
require 'rails_helper'

Jacob Vosmaer's avatar
Jacob Vosmaer committed
3
describe RepositoryCheckMailer do
Jacob Vosmaer's avatar
Jacob Vosmaer committed
4 5 6 7
  include EmailSpec::Matchers

  describe '.notify' do
    it 'emails all admins' do
Jacob Vosmaer's avatar
Jacob Vosmaer committed
8
      admins = create_list(:admin, 3)
Jacob Vosmaer's avatar
Jacob Vosmaer committed
9 10 11 12 13 14 15 16 17

      mail = described_class.notify(1)

      expect(mail).to deliver_to admins.map(&:email)
    end

    it 'mentions the number of failed checks' do
      mail = described_class.notify(3)

18
      expect(mail).to have_subject 'GitLab Admin | 3 projects failed their last repository check'
Jacob Vosmaer's avatar
Jacob Vosmaer committed
19 20 21
    end
  end
end