Commit 3d1f0df3 authored by Matthias Käppler's avatar Matthias Käppler

Merge branch 'hchouraria-fix-incoming-email-check-rake-task' into 'master'

Permit symbols when loading mail_room.yml

See merge request gitlab-org/gitlab!62780
parents 610b19c1 b2fb691e
......@@ -52,7 +52,7 @@ module SystemCheck
def load_config
erb = ERB.new(File.read(mail_room_config_path))
erb.filename = mail_room_config_path
config_file = YAML.safe_load(erb.result)
config_file = YAML.safe_load(erb.result, permitted_classes: [Symbol])
config_file[:mailboxes]
end
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment