spec/hashie/extensions/indifferent_access_spec.rb in hashie-3.0.0 vs spec/hashie/extensions/indifferent_access_spec.rb in hashie-3.1.0

- old
+ new

@@ -24,9 +24,23 @@ class << self alias_method :build, :try_convert end end + class IndifferentHashWithDash < Hashie::Dash + include Hashie::Extensions::IndifferentAccess + property :foo + end + + describe 'when included in dash' do + let(:params) { { foo: 'bar' } } + subject { IndifferentHashWithDash.new(params) } + + it 'initialize with a symbol' do + expect(subject.foo).to eq params[:foo] + end + end + shared_examples_for 'hash with indifferent access' do it 'is able to access via string or symbol' do h = subject.build(abc: 123) expect(h[:abc]).to eq 123 expect(h['abc']).to eq 123