Sha256: e7f359c62a37f810e0bf235ced9619a26921cc41c3b5976547c294ca802ee341

Contents?: true

Size: 685 Bytes

Versions: 27

Compression:

Stored size: 685 Bytes

Contents

require 'spec_helper'
require 'core_ext/hash'

describe Hash do

  it { should respond_to(:symbolize_keys) }
  it { should respond_to(:symbolize_keys!) }

  it "manipulates keys correctly" do
    {
      '1' => 1,
      '2' => 2,
      '3' => 3
    }.symbolize_keys.should == {
      :"1" => 1,
      :"2" => 2,
      :"3" => 3
    }
  end

  it "returns copy when bang not provided" do
    hsh = { '1' => 1, '2' => 2, '3' => 3 }
    hsh.symbolize_keys
    hsh.should == { '1' => 1, '2' => 2, '3' => 3 }
  end

  it "replaces self when bang provided" do
    hsh = { '1' => 1, '2' => 2, '3' => 3 }
    hsh.symbolize_keys!
    hsh.should == { :"1" => 1, :"2" => 2, :"3" => 3 }
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fozzie-0.0.27 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.26 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.25 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.24 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.23 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.22 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.21 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.20 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.19 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.18 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.17 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.16 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.15 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.14 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.13 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.12 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.11 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.10 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.9 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.8 spec/lib/core_ext/hash_spec.rb