debian-mirror-gitlab/spec/config/mail_room_spec.rb

52 lines
1.5 KiB
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
require 'spec_helper'
2016-06-02 11:05:42 +05:30
2016-09-13 17:45:13 +05:30
describe 'mail_room.yml' do
let(:config_path) { 'config/mail_room.yml' }
2016-06-02 11:05:42 +05:30
let(:configuration) { YAML.load(ERB.new(File.read(config_path)).result) }
2016-09-13 17:45:13 +05:30
context 'when incoming email is disabled' do
2016-06-02 11:05:42 +05:30
before do
2016-09-13 17:45:13 +05:30
ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/mail_room_disabled.yml').to_s
Gitlab::MailRoom.reset_config!
2016-06-02 11:05:42 +05:30
end
after do
2016-09-13 17:45:13 +05:30
ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = nil
2016-06-02 11:05:42 +05:30
end
2016-09-13 17:45:13 +05:30
it 'contains no configuration' do
2016-06-02 11:05:42 +05:30
expect(configuration[:mailboxes]).to be_nil
end
end
2016-09-13 17:45:13 +05:30
context 'when incoming email is enabled' do
2016-06-02 11:05:42 +05:30
before do
2016-09-13 17:45:13 +05:30
ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/mail_room_enabled.yml').to_s
Gitlab::MailRoom.reset_config!
2016-06-02 11:05:42 +05:30
end
after do
2016-09-13 17:45:13 +05:30
ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = nil
2016-06-02 11:05:42 +05:30
end
2016-09-13 17:45:13 +05:30
it 'contains the intended configuration' do
2016-06-02 11:05:42 +05:30
expect(configuration[:mailboxes].length).to eq(1)
mailbox = configuration[:mailboxes].first
2016-09-13 17:45:13 +05:30
expect(mailbox[:host]).to eq('imap.gmail.com')
2016-06-02 11:05:42 +05:30
expect(mailbox[:port]).to eq(993)
expect(mailbox[:ssl]).to eq(true)
expect(mailbox[:start_tls]).to eq(false)
2016-09-13 17:45:13 +05:30
expect(mailbox[:email]).to eq('gitlab-incoming@gmail.com')
expect(mailbox[:password]).to eq('[REDACTED]')
expect(mailbox[:name]).to eq('inbox')
redis_url = Gitlab::Redis.url
2016-06-02 11:05:42 +05:30
expect(mailbox[:delivery_options][:redis_url]).to eq(redis_url)
expect(mailbox[:arbitration_options][:redis_url]).to eq(redis_url)
end
end
end