diff options
author | Bobby McDonald <bobbymcwho@gmail.com> | 2020-01-12 21:22:14 -0500 |
---|---|---|
committer | Bobby McDonald <bobbymcwho@gmail.com> | 2020-01-13 15:52:04 -0500 |
commit | 6f79eb82f66952451dd972fbee08df169e2cfba6 (patch) | |
tree | 16d8e19f6f07ad6d2e8662ac270d8f5de5affe02 /spec/hashie/mash_spec.rb | |
parent | a1fa33d4259079f434b6d0820562e670d446582f (diff) | |
download | hashie-6f79eb82f66952451dd972fbee08df169e2cfba6.tar.gz |
Only define compact on ruby >= 2.4
Diffstat (limited to 'spec/hashie/mash_spec.rb')
-rw-r--r-- | spec/hashie/mash_spec.rb | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb index 4629124..603adc0 100644 --- a/spec/hashie/mash_spec.rb +++ b/spec/hashie/mash_spec.rb @@ -882,27 +882,6 @@ describe Hashie::Mash do end end - describe '#compact' do - subject(:mash) { described_class.new(a: 1, b: nil) } - - it 'returns a Hashie::Mash' do - expect(mash.compact).to be_kind_of(described_class) - end - - it 'removes keys with nil values' do - expect(mash.compact).to eq('a' => 1) - end - - context 'when using with subclass' do - let(:subclass) { Class.new(Hashie::Mash) } - subject(:sub_mash) { subclass.new(a: 1, b: nil) } - - it 'creates an instance of subclass' do - expect(sub_mash.compact).to be_kind_of(subclass) - end - end - end - describe '#invert' do subject(:mash) { described_class.new(a: 'apple', b: 4) } @@ -1027,6 +1006,27 @@ describe Hashie::Mash do end end end + + describe '#compact' do + subject(:mash) { described_class.new(a: 1, b: nil) } + + it 'returns a Hashie::Mash' do + expect(mash.compact).to be_kind_of(described_class) + end + + it 'removes keys with nil values' do + expect(mash.compact).to eq('a' => 1) + end + + context 'when using with subclass' do + let(:subclass) { Class.new(Hashie::Mash) } + subject(:sub_mash) { subclass.new(a: 1, b: nil) } + + it 'creates an instance of subclass' do + expect(sub_mash.compact).to be_kind_of(subclass) + end + end + end end with_minimum_ruby('2.5.0') do |