Welcome to mirror list, hosted at ThFree Co, Russian Federation.

imap_authentication_check_spec.rb « incoming_email « system_check « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d7a77a844729ca8e399e358732878cdc6f2268ac (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
# frozen_string_literal: true

require 'fast_spec_helper'

MAIL_ROOM_CONFIG_ENABLED_SAMPLE =
  ":mailboxes:\n"\
  "  \n"\
  "    -\n"\
  "      :host: \"gitlab.example.com\"\n"\
  "      :port: 143\n"\
  ""

RSpec.describe SystemCheck::IncomingEmail::ImapAuthenticationCheck do
  subject(:system_check) { described_class.new }

  describe '#load_config' do
    subject { system_check.send(:load_config) }

    context 'returns no mailbox configurations with mailroom default configuration' do
      it { is_expected.to be_nil }
    end

    context 'returns an array of mailbox configurations with mailroom configured' do
      before do
        allow(File).to receive(:read).and_return(MAIL_ROOM_CONFIG_ENABLED_SAMPLE)
      end

      it { is_expected.to eq([{ host: "gitlab.example.com", port: 143 }]) }
    end
  end
end