spec/sugar-high/hash_spec.rb in sugar-high-0.6.0 vs spec/sugar-high/hash_spec.rb in sugar-high-0.6.1

- old
+ new

@@ -1,9 +1,16 @@ require 'spec_helper' require 'sugar-high/hash' describe "SugarHigh" do describe "Hash packet" do + describe '#rewrite' do + it 'should rewrite keys of the hash' do + mapping = {:a => :new_a, :b => :new_b} + {:a => 'hello', :b => 'hi', :c => 'hi'}.rewrite(mapping).should == {:new_a => 'hello', :new_b => 'hi', :c => 'hi'} + end + end + describe '#hash_revert' do it "should revert hash" do {:a => 'hello', :b => 'hi', :c => 'hi'}.hash_revert.should == {'hello' => [:a], 'hi' => [:b, :c]} end