blob: f554840ec786b9b4dbcb2d20d9afceca050741f4 (
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
55
56
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::ServiceDesk do
before do
allow(Gitlab::IncomingEmail).to receive(:enabled?).and_return(true)
allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(true)
end
describe 'enabled?' do
let_it_be(:project) { create(:project) }
subject { described_class.enabled?(project: project) }
it { is_expected.to be_truthy }
context 'when service desk is not supported' do
before do
allow(described_class).to receive(:supported?).and_return(false)
end
it { is_expected.to be_falsy }
end
context 'when service desk is disabled for project' do
before do
project.update!(service_desk_enabled: false)
end
it { is_expected.to be_falsy }
end
end
describe 'supported?' do
subject { described_class.supported? }
it { is_expected.to be_truthy }
context 'when incoming emails are disabled' do
before do
allow(Gitlab::IncomingEmail).to receive(:enabled?).and_return(false)
end
it { is_expected.to be_falsy }
end
context 'when email key is not supported' do
before do
allow(Gitlab::IncomingEmail).to receive(:supports_wildcard?).and_return(false)
end
it { is_expected.to be_falsy }
end
end
end
|