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.7 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.6 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.5 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.4 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.3 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.2 spec/lib/core_ext/hash_spec.rb
fozzie-0.0.1 spec/lib/core_ext/hash_spec.rb