summaryrefslogtreecommitdiff
path: root/spec/hashie/extensions/indifferent_access_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/hashie/extensions/indifferent_access_spec.rb')
-rw-r--r--spec/hashie/extensions/indifferent_access_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/hashie/extensions/indifferent_access_spec.rb b/spec/hashie/extensions/indifferent_access_spec.rb
index 612f276..c48ad0c 100644
--- a/spec/hashie/extensions/indifferent_access_spec.rb
+++ b/spec/hashie/extensions/indifferent_access_spec.rb
@@ -315,6 +315,18 @@ describe Hashie::Extensions::IndifferentAccess do
end
end
end
+
+ with_minimum_ruby('2.5.0') do
+ describe '#slice' do
+ let(:h) { subject.build(foo: 'bar', baz: 'qux') }
+
+ it 'indifferently slices the hash' do
+ sliced_h = { 'foo' => 'bar' }
+ expect(h.slice('foo')).to eq sliced_h
+ expect(h.slice(:foo)).to eq sliced_h
+ end
+ end
+ end
end
describe 'with merge initializer' do