Skip to content

Commit

Permalink
Fix syntax in specs, for Ruby 3+
Browse files Browse the repository at this point in the history
  • Loading branch information
ismasan committed May 24, 2024
1 parent be986a6 commit 50fba7e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec/hash_mapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}+++"}
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 50fba7e

Please sign in to comment.