Sha256: e092d7ad45368514303f6635d750330f78bcc1a38c75d51aaf82cea5f96c3f98

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')
require 'simply_useful/core_ext/hash'

describe SimplyUseful::CoreExtensions::Keys do

  describe ".deep_symbolize_keys" do
    it "should symbolize keys in a simple one-level hash" do
      t = {"a" => "b", "c" => 2}
      ta = t.deep_symbolize_keys
      te = {:a => "b", :c => 2}
      te.should == ta
    end

    it "should symbolize keys in a two-level deep hash" do
      t = {"a" => {"b" => "c"}}
      ta = t.deep_symbolize_keys
      te = {:a => {:b => "c"}}
      te.should == ta
    end

    it "should symbolize keys in child array's hashes" do
      t = {"a" => [{"b" => "c", "d" => "e"}]}
      te = {:a => [{:b => "c", :d => "e"}]}
      ta = t.deep_symbolize_keys
      te.should == ta
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simply_useful-0.2.3 spec/core_ext/hash_spec.rb
simply_useful-0.2.2 spec/core_ext/hash_spec.rb
simply_useful-0.2.1 spec/core_ext/hash_spec.rb
simply_useful-0.2.0 spec/core_ext/hash_spec.rb