From 50fba7e9fcc39452d2bfb6b4fbbc419de48c71b8 Mon Sep 17 00:00:00 2001 From: Ismael Celis Date: Fri, 24 May 2024 10:10:39 +0100 Subject: [PATCH] Fix syntax in specs, for Ruby 3+ --- spec/hash_mapper_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/hash_mapper_spec.rb b/spec/hash_mapper_spec.rb index 9ffc0e1..7b46fcc 100644 --- a/spec/hash_mapper_spec.rb +++ b/spec/hash_mapper_spec.rb @@ -156,7 +156,7 @@ class WithArrays class PersonWithBlock extend HashMapper - def self.normalize(*_) + def self.normalize(...) super end map from('/names/first'){|n| n.gsub('+','')}, to('/first_name'){|n| "+++#{n}+++"} @@ -396,7 +396,7 @@ class C < B end it "should not affect other mappers" do - expect(NotRelated.normalize('n' => 'nn')).to eq({n: {n: 'nn'}}) + expect(NotRelated.normalize({'n' => 'nn'})).to eq({n: {n: 'nn'}}) end end @@ -409,17 +409,17 @@ class MixedMappings describe "dealing with strings and symbols" do it "should be able to normalize from a nested hash with string keys" do - expect(MixedMappings.normalize( + expect(MixedMappings.normalize({ 'big' => {'jobs' => 5}, 'timble' => 3.2 - )).to eq({dodo: 5, bingo: {biscuit: 3.2}}) + })).to eq({dodo: 5, bingo: {biscuit: 3.2}}) end it "should not symbolized keys in value hashes" do - expect(MixedMappings.normalize( + expect(MixedMappings.normalize({ 'big' => {'jobs' => 5}, 'timble' => {'string key' => 'value'} - )).to eq({dodo: 5, bingo: {biscuit: {'string key' => 'value'}}}) + })).to eq({dodo: 5, bingo: {biscuit: {'string key' => 'value'}}}) end end @@ -433,9 +433,9 @@ class DefaultValues describe "default values" do it "should use a default value whenever a key is not set" do - expect(DefaultValues.normalize( + expect(DefaultValues.normalize({ 'without_default' => 'some_value' - )).to eq({ not_defaulted: 'some_value', defaulted: 'the_default_value' }) + })).to eq({ not_defaulted: 'some_value', defaulted: 'the_default_value' }) end it "should not use a default if a key is set (even if the value is falsy)" do