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.5.6 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.7 spec/core_ext/hash_spec.rb
benschwarz-smoke-0.5.8 spec/core_ext/hash_spec.rb
smoke-0.5.20 spec/core_ext/hash_spec.rb
smoke-0.5.19 spec/core_ext/hash_spec.rb
smoke-0.5.17 spec/core_ext/hash_spec.rb
smoke-0.5.16 spec/core_ext/hash_spec.rb
smoke-0.5.15 spec/core_ext/hash_spec.rb
smoke-0.5.14 spec/core_ext/hash_spec.rb
smoke-0.5.13 spec/core_ext/hash_spec.rb
smoke-0.5.12 spec/core_ext/hash_spec.rb
smoke-0.5.10 spec/core_ext/hash_spec.rb
smoke-0.5.9 spec/core_ext/hash_spec.rb
smoke-0.5.11 spec/core_ext/hash_spec.rb