Sha256: 3cbe96052b950cccba229f77f5c1e1c4b123e4a24fb4c70a559e1fee886738c3

Contents?: true

Size: 891 Bytes

Versions: 1

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper'

describe HSS::Parser do
  let(:config) { 'spec/test/config.yml' }
  let(:handler) { HSS::Handler.new config }

  describe '#external' do
    it 'reads values from a YAML file' do
      expect(handler.handle('ext_test.first.color')).to eql 'external_blue'
    end
    context 'when a key is not found' do
      it 'raises an error' do
        expect { handler.handle 'ext_test.three' }.to raise_error NameError
        expect { handler.handle 'ext_test.five.tree' }.to raise_error NameError
      end
    end
    context 'when the source does not exist' do
      it 'raises an error' do
        expect { handler.handle 'failext_abcd' }.to raise_error RuntimeError
      end
    end
    context 'when the source YAML is invalid' do
      it 'raises an error' do
        expect { handler.handle 'failext_invalid' }.to raise_error RuntimeError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hss-1.1.0 spec/helpers/external_spec.rb