Sha256: f86e4f25e4f428ec76465a0cf7659599a5af3e939821bfd715c6e7f108109ab2

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe Alerty::Config do
  describe 'configure' do
    before do
      Alerty::Config.configure(
        log_path: '/tmp/foo',
        log_level: 'fatal',
        timeout: 20,
        lock_path: '/tmp/lock',
      )
    end

    it { expect(Alerty::Config.log_path).to eql('/tmp/foo') }
    it { expect(Alerty::Config.log_level).to eql('fatal') }
    it { expect(Alerty::Config.timeout).to eql(20) }
    it { expect(Alerty::Config.lock_path).to eql('/tmp/lock') }
  end

  describe 'config' do
    before do
      Alerty::Config.instance_variable_set(:@config, Hashie::Mash.new(
        log_path: '/tmp/foo',
        log_level: 'fatal',
        timeout: 20,
        lock_path: '/tmp/lock',
      ))
    end

    it { expect(Alerty::Config.log_path).to eql('/tmp/foo') }
    it { expect(Alerty::Config.log_level).to eql('fatal') }
    it { expect(Alerty::Config.timeout).to eql(20) }
    it { expect(Alerty::Config.lock_path).to eql('/tmp/lock') }
  end

  describe 'plugins' do
    before do
      Alerty::Config.reset
      Alerty::Config.instance_variable_set(:@config, Hashie::Mash.new(
        log_path: '/tmp/foo',
        log_level: 'fatal',
        timeout: 20,
        lock_path: '/tmp/lock',
        plugins: [
          {
            type: 'stdout',
          },
          {
            type: 'file',
            path: 'STDOUT',
          }
        ]
      ))
    end

    it do
      expect(Alerty::Config.plugins[0]).to be_a(Alerty::Plugin::Stdout)
      expect(Alerty::Config.plugins[1]).to be_a(Alerty::Plugin::File)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alerty-0.0.8 spec/config_spec.rb
alerty-0.0.7 spec/config_spec.rb
alerty-0.0.6 spec/config_spec.rb
alerty-0.0.5 spec/config_spec.rb
alerty-0.0.4 spec/config_spec.rb