Sha256: 7af54246c585a02e3feae22ad9ba59b0cec8b78be16fb773585060878056c81c

Contents?: true

Size: 890 Bytes

Versions: 8

Compression:

Stored size: 890 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

8 entries across 8 versions & 1 rubygems

Version Path
hss-1.0.1 spec/helpers/external_spec.rb
hss-1.0.0 spec/helpers/external_spec.rb
hss-0.2.11 spec/helpers/external_spec.rb
hss-0.2.10 spec/helpers/external_spec.rb
hss-0.2.9 spec/helpers/external_spec.rb
hss-0.2.8 spec/helpers/external_spec.rb
hss-0.2.6 spec/helpers/external_spec.rb
hss-0.2.5 spec/helpers/external_spec.rb