Sha256: ef4ac9daa1ea76bbd780c8fc7e17c5ea8a44c6a0fc534fda3675fbc004cea1e9

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe MailRoom::Configuration do
  let(:config_path) {File.expand_path('../fixtures/test_config.yml', File.dirname(__FILE__))}

  describe '#initalize' do
    context 'with config_path' do
      let(:configuration) { MailRoom::Configuration.new(:config_path => config_path) }

      it 'parses yaml into mailbox objects' do
        MailRoom::Mailbox.stubs(:new).returns('mailbox1', 'mailbox2')

        expect(configuration.mailboxes).to eq(['mailbox1', 'mailbox2'])
      end

      it 'parses health check' do
        expect(configuration.health_check).to be_a(MailRoom::HealthCheck)
      end
    end

    context 'without config_path' do
      let(:configuration) { MailRoom::Configuration.new }

      it 'sets mailboxes to an empty set' do
        MailRoom::Mailbox.stubs(:new)
        MailRoom::Mailbox.expects(:new).never

        expect(configuration.mailboxes).to eq([])
      end

      it 'sets the health check to nil' do
        expect(configuration.health_check).to be_nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-mail_room-0.0.11 spec/lib/configuration_spec.rb
gitlab-mail_room-0.0.10 spec/lib/configuration_spec.rb
gitlab-mail_room-0.0.9 spec/lib/configuration_spec.rb