Sha256: ad4f352efdd8e725d36e47c9a2aacfcbc259066b2b5fea7c959e9ff0a1365a0f

Contents?: true

Size: 663 Bytes

Versions: 24

Compression:

Stored size: 663 Bytes

Contents

RSpec.describe "EitilCore Hash#transform_string_values" do

  it "should transforms all strings in infinite recursion" do
    hash     = {a: "hey", b: {c: "hi", d: ["ho"]}}
    expected = {a: "HEY", b: {c: "HI", d: ["HO"]}}
    result   = hash.transform_string_values { |str| str.upcase }

    expect(result).to eq expected
  end

end


RSpec.describe "EitilCore Hash#transform_string_values!" do

  it "should transforms all strings in infinite recursion" do
    hash     = {a: "hey", b: {c: "hi", d: ["ho"]}}
    expected = {a: "HEY", b: {c: "HI", d: ["HO"]}}

    hash.transform_string_values! { |str| str.upcase }
    expect(hash).to eq expected
  end
  
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
eitil-2.0.8 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.7 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.6 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.5 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.4 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.3 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.2 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.1 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-2.0.0 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.4.1 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.4.0 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.12 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.11 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.10 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.9 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.8 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.7 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.6 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.5 spec/eitil_core/hash/transform_string_values_spec.rb
eitil-1.3.4 spec/eitil_core/hash/transform_string_values_spec.rb