Sha256: 472ec600319f16a9842601a32f6309697ca7c5a5f999835c41d4b67fd7ed71b1

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

describe Darthjee::CoreExt::Hash::Cameliazable do
  describe 'camlize_keys' do
    subject(:hash) do
      { first_key: 1, 'second_key' => 2 }
    end

    context 'when no option is given' do
      it 'camelize all keys' do
        result = hash.camelize_keys
        expect(result).to eq(FirstKey: 1, 'SecondKey' => 2)
      end
    end

    context 'when passing uppercase_first_letter option' do
      it 'camelize all keys' do
        result = hash.camelize_keys(uppercase_first_letter: false)
        expect(result).to eq(firstKey: 1, 'secondKey' => 2)
      end
    end
  end

  describe '#lower_camelize_keys' do
    subject(:hash) do
      { first_key: 1, 'second_key' => 2 }
    end

    it 'camelize all keys' do
      result = hash.lower_camelize_keys
      expect(result).to eq(firstKey: 1, 'secondKey' => 2)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
darthjee-core_ext-1.7.4 spec/integration/yard/darthjee/core_ext/hash/cameliazable_spec.rb