File: configuration_spec.rb

package info (click to toggle)
ruby-mail-room 0.10.0%2Breally0.0.9-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 376 kB
  • sloc: ruby: 1,749; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
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
32
33
34
35
36
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