diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/hashie/extensions/indifferent_access_spec.rb | 12 | ||||
-rw-r--r-- | spec/hashie/mash_spec.rb | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/spec/hashie/extensions/indifferent_access_spec.rb b/spec/hashie/extensions/indifferent_access_spec.rb index 0aec787..27585f1 100644 --- a/spec/hashie/extensions/indifferent_access_spec.rb +++ b/spec/hashie/extensions/indifferent_access_spec.rb @@ -357,6 +357,18 @@ describe Hashie::Extensions::IndifferentAccess do end end end + + with_minimum_ruby('3.0.0') do + describe '#except' do + let(:h) { subject.build(foo: 'bar', baz: 'qux') } + + it 'indifferently excepts keys from the hash' do + sliced_h = { 'baz' => 'qux' } + expect(h.except('foo')).to eq sliced_h + expect(h.except(:foo)).to eq sliced_h + end + end + end end describe 'with merge initializer' do diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb index 4731985..84a28ea 100644 --- a/spec/hashie/mash_spec.rb +++ b/spec/hashie/mash_spec.rb @@ -1097,4 +1097,17 @@ describe Hashie::Mash do end end end + + with_minimum_ruby('3.0.0') do + context '#except' do + subject(:mash) { described_class.new(a: 'A', b: 'B') } + it 'return a Hashie::Mash' do + expect(mash.except(:b)).to be_kind_of(described_class) + end + + it 'excludes keys' do + expect(mash.except(:b)).to eq('a' => 'A') + end + end + end end |