Sha256: 459f6293cdea62ea638122212f679ed5fc7f4a0cc298c7b8e58cbda8113ccf01

Contents?: true

Size: 529 Bytes

Versions: 4

Compression:

Stored size: 529 Bytes

Contents

require 'spec_helper'

require 'observed/hash/fetcher'

describe Observed::Hash::Fetcher do

  subject {
    described_class.new(hash)
  }

  context 'when the source hash is nil' do

    let(:hash) { nil }

    it 'fails' do
      expect { subject }.to raise_error
    end
  end

  context 'when the source hash is nested' do

    let(:hash) { {foo:{bar:1},baz:2} }

    it 'decodes the key path to recursively find the value' do
      expect(subject['foo.bar']).to eq(1)
      expect(subject['baz']).to eq(2)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
observed-0.2.0 spec/hash/fetcher_spec.rb
observed-0.2.0.rc2 spec/hash/fetcher_spec.rb
observed-0.2.0.rc1 spec/hash/fetcher_spec.rb
observed-0.1.1 spec/hash/fetcher_spec.rb