summaryrefslogtreecommitdiff
path: root/spec/hashie/mash_spec.rb
diff options
context:
space:
mode:
authorJack Jennings <jack.jennings@leafly.com>2021-04-06 17:45:02 -0700
committerJack Jennings <jack.jennings@leafly.com>2021-11-02 12:57:54 -0700
commit9ba96e03a8b5baa098c7ac6841e4c021b02f1910 (patch)
tree811945a20cb508cbc6866b0dacad999c1486e7ed /spec/hashie/mash_spec.rb
parent16eb591205092dab88d87673263ddf02014a350a (diff)
downloadhashie-9ba96e03a8b5baa098c7ac6841e4c021b02f1910.tar.gz
Add #except under Ruby 3
Ruby 3 adds the Hash#except method, which should return the correct Hashie object instance when called on a Mash or object using the Hashie::Extensions::IndifferentAccess mixin.
Diffstat (limited to 'spec/hashie/mash_spec.rb')
-rw-r--r--spec/hashie/mash_spec.rb13
1 files changed, 13 insertions, 0 deletions
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