debian-mirror-gitlab/spec/lib/gitlab/service_desk_spec.rb

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

57 lines
1.3 KiB
Ruby
Raw Permalink Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::ServiceDesk do
before do
2023-06-20 00:43:36 +05:30
allow(Gitlab::Email::IncomingEmail).to receive(:enabled?).and_return(true)
allow(Gitlab::Email::IncomingEmail).to receive(:supports_wildcard?).and_return(true)
2020-07-28 23:09:34 +05:30
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
2023-06-20 00:43:36 +05:30
allow(Gitlab::Email::IncomingEmail).to receive(:enabled?).and_return(false)
2020-07-28 23:09:34 +05:30
end
it { is_expected.to be_falsy }
end
context 'when email key is not supported' do
before do
2023-06-20 00:43:36 +05:30
allow(Gitlab::Email::IncomingEmail).to receive(:supports_wildcard?).and_return(false)
2020-07-28 23:09:34 +05:30
end
it { is_expected.to be_falsy }
end
end
end