Sha256: d9e7d267b2cf08ad3729df69a1b8262c96ce13e999b3f1653ca61131b6db2399

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Elasticonf::Loader do
  subject do
    file = Elasticonf.root.join('spec', 'fixtures', 'config.yml')
    described_class[YAML.load_file(file)]
  end

  it 'should be inherited from Hashie::Mash' do
    subject.should be_kind_of(Hashie::Mash)
  end

  describe '#get' do
    it 'should return nil' do
      expect(subject.get('some.unexisting.key')).to be_nil
    end

    it 'should return some value' do
      expect(subject.get('some_config.int_key')).to eql(1)
    end

    it 'should return some value' do
      expect(subject.get('some_config.str_key')).to eql('1')
    end

    context 'when wrong argument given' do
      it 'should raise an error' do
        expect { subject.get }.to raise_error
      end

      it 'should raise an error' do
        expect { subject.get({}) }.to raise_error
      end

      it 'should raise an error' do
        expect { subject.get([]) }.to raise_error
      end

      it 'should raise an error' do
        expect { subject.get(false) }.to raise_error
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticonf-1.1.5 spec/lib/elasticonf/loader_spec.rb
elasticonf-1.1.4 spec/lib/elasticonf/loader_spec.rb