summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorBobby McDonald <bobbymcwho@gmail.com>2020-01-12 21:22:14 -0500
committerBobby McDonald <bobbymcwho@gmail.com>2020-01-13 15:52:04 -0500
commit6f79eb82f66952451dd972fbee08df169e2cfba6 (patch)
tree16d8e19f6f07ad6d2e8662ac270d8f5de5affe02 /spec
parenta1fa33d4259079f434b6d0820562e670d446582f (diff)
downloadhashie-6f79eb82f66952451dd972fbee08df169e2cfba6.tar.gz
Only define compact on ruby >= 2.4
Diffstat (limited to 'spec')
-rw-r--r--spec/hashie/mash_spec.rb42
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