blob: 710702b93fc919ed86a58db91b973e629ce3a7fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe SystemCheck::IncomingEmailCheck do
before do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
end
describe '#multi_check' do
context 'when incoming e-mail is disabled' do
before do
stub_incoming_email_setting(enabled: false)
end
it 'does not run any checks' do
expect(SystemCheck).not_to receive(:run)
subject.multi_check
end
end
context 'when incoming e-mail is enabled for IMAP' do
before do
stub_incoming_email_setting(enabled: true)
end
it 'runs IMAP and mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [
SystemCheck::IncomingEmail::ImapAuthenticationCheck,
SystemCheck::IncomingEmail::InitdConfiguredCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck
])
subject.multi_check
end
end
context 'when incoming e-mail is enabled for Microsoft Graph' do
before do
stub_incoming_email_setting(enabled: true, inbox_method: 'microsoft_graph')
end
it 'runs mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [
SystemCheck::IncomingEmail::InitdConfiguredCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck
])
subject.multi_check
end
end
end
end
|