Sha256: 08c338c0025760660b2585d9d9c27caca35c329dca15a89ab6d7acaa95c26f02

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Anyway::Ext::Hash do
  using Anyway::Ext::Hash

  describe "#stringify_keys!" do
    let(:source) do
      {
        a: 1,
        b: 'hello',
        c: {
          id: 1
        }
      }
    end

    let(:expected_result) do
      {
        'a' => 1,
        'b' => 'hello',
        'c' => {
          'id' => 1
        }
      }
    end

    it "transforms keys of hash to strings" do
      source.stringify_keys!

      expect(source).to eq(expected_result)
    end

    it "returns a hash with transformed keys to strings" do
      expect(source.stringify_keys!).to eq(expected_result)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anyway_config-1.4.4 spec/ext/hash_spec.rb
anyway_config-1.4.3 spec/ext/hash_spec.rb
anyway_config-1.4.2 spec/ext/hash_spec.rb
anyway_config-1.4.1 spec/ext/hash_spec.rb
anyway_config-1.4.0 spec/ext/hash_spec.rb