Sha256: 428b886d4dd0f2f4b1f1e33f9d64c08b8198ebe4c0bd1fb2fdd0f05ad0547962

Contents?: true

Size: 918 Bytes

Versions: 10

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'lite_spec_helper'

describe Mongo::Utils do
  describe '#shallow_symbolize_keys' do
    it 'symbolizes' do
      described_class.shallow_symbolize_keys(
        'foo' => 'bar',
        'aKey' => 'aValue',
        'a_key' => 'a_value',
        key: :value,
      ).should == {
        foo: 'bar',
        aKey: 'aValue',
        a_key: 'a_value',
        key: :value,
      }
    end
  end

  describe '#shallow_camelize_keys' do
    it 'camelizes' do
      described_class.shallow_camelize_keys(
        'foo' => 'bar',
        'aKey' => 'aValue',
        'aa_key' => 'a_value',
        key: :value,
        sKey: :sValue,
        us_key: :us_value,
      ).should == {
        'foo' => 'bar',
        'aKey' => 'aValue',
        'aaKey' => 'a_value',
        'key' => :value,
        'sKey' => :sValue,
        'usKey' => :us_value,
      }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mongo-2.17.4 spec/mongo/utils_spec.rb
mongo-2.18.3 spec/mongo/utils_spec.rb
mongo-2.18.2 spec/mongo/utils_spec.rb
mongo-2.17.3 spec/mongo/utils_spec.rb
mongo-2.18.1 spec/mongo/utils_spec.rb
mongo-2.18.0 spec/mongo/utils_spec.rb
mongo-2.17.2 spec/mongo/utils_spec.rb
mongo-2.18.0.beta1 spec/mongo/utils_spec.rb
mongo-2.17.1 spec/mongo/utils_spec.rb
mongo-2.17.0 spec/mongo/utils_spec.rb