diff options
Diffstat (limited to 'spec/hashie/extensions/deep_fetch_spec.rb')
-rw-r--r-- | spec/hashie/extensions/deep_fetch_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/hashie/extensions/deep_fetch_spec.rb b/spec/hashie/extensions/deep_fetch_spec.rb index 7026020..3459042 100644 --- a/spec/hashie/extensions/deep_fetch_spec.rb +++ b/spec/hashie/extensions/deep_fetch_spec.rb @@ -21,27 +21,27 @@ module Hashie describe '#deep_fetch' do it 'extracts a value from a nested hash' do - instance.deep_fetch(:library, :location, :address).should eq('123 Library St.') + expect(instance.deep_fetch(:library, :location, :address)).to eq('123 Library St.') end it 'extracts a value from a nested array' do - instance.deep_fetch(:library, :books, 1, :title).should eq('Moby Dick') + expect(instance.deep_fetch(:library, :books, 1, :title)).to eq('Moby Dick') end context 'when one of the keys is not present' do context 'when a block is provided' do it 'returns the value of the block' do value = instance.deep_fetch(:library, :unknown_key, :location) { 'block value' } - value.should eq('block value') + expect(value).to eq('block value') end end context 'when a block is not provided' do context 'when the nested object is an array' do it 'raises an UndefinedPathError' do - lambda do + expect do instance.deep_fetch(:library, :books, 2) - end.should( + end.to( raise_error( DeepFetch::UndefinedPathError, 'Could not fetch path (library > books > 2) at 2' @@ -52,9 +52,9 @@ module Hashie context 'when the nested object is a hash' do it 'raises a UndefinedPathError' do - lambda do + expect do instance.deep_fetch(:library, :location, :unknown_key) - end.should( + end.to( raise_error( DeepFetch::UndefinedPathError, 'Could not fetch path (library > location > unknown_key) at unknown_key' |