Sha256: 7e21354ee9898e122ba9d6a71d81cf246912d12e50ef1166d33b0506439781b5

Contents?: true

Size: 679 Bytes

Versions: 34

Compression:

Stored size: 679 Bytes

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")

describe Hash do
  before :all do
    @item = {:a => "a key", :c => "another key"}
  end
  
  describe "transformations" do
    it "should be renamable" do
      @item.should respond_to(:rename)
    end
    
    it "should have a transform object" do
      @item.rename(:a => :b).should == {:b => "a key", :c => "another key"}
    end
    
    it "should rename many keys" do
      @item.rename(:a => :b, :c => :d).should == {:b => "a key", :d => "another key"}
    end
    
    it "should symbolise string keys" do
      {"a" => {"b" => "bee"}}.symbolize_keys!.should == {:a => {:b => "bee"}}
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
benschwarz-smoke-0.2.3 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.2.4 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.10 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.11 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.4 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.5 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.6 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.7 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.3.9 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.4.0 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.4.1 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.4.2 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.0 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.1 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.10 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.13 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.2 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.3 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.4 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.5 spec/core_ext/hash_spec.rb