Sha256: d498150fefc5a0a09eefe3c3a96cae9feb47a913d235cd9096740d37555709c1
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
module JsonPath RSpec.describe DefaultDataWrapper do describe '#[]' do context 'when the wrapped object is a hash with string keys' do let(:data) { { 'name' => 'John', 'age' => 30 } } let(:wrapper) { described_class.new(data) } it 'returns the value associated with the symbol key' do expect(wrapper[:name]).to eq('John') expect(wrapper[:age]).to eq(30) end it 'does not modify the original hash' do expect { wrapper[:name] }.not_to(change { data }) end end context 'when the wrapped object is a hash with symbol keys' do let(:data) { { name: 'John', age: 30 } } let(:wrapper) { described_class.new(data) } it 'returns the value associated with the symbol key' do expect(wrapper[:name]).to eq('John') expect(wrapper[:age]).to eq(30) end it 'does not modify the original hash' do expect { wrapper[:name] }.not_to(change { data }) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems