Sha256: 5e04a15e41479ad34eb713aeefccb01303de3ee8f340cec7b37a883052fc185a

Contents?: true

Size: 815 Bytes

Versions: 3

Compression:

Stored size: 815 Bytes

Contents

require 'spec_helper'
module Noe
  describe "Hash#methodize!" do
    
    let(:thehash){ 
      { 'name'     => "Noe", 
        :version   => Noe::VERSION,
        'subhash'  => { 'entry' => 12 },
        'subarray' => [ { 'entry' => 12 } ]
      }
    }
    
    it "should be recursive by default" do
      thehash.methodize!
      thehash.name.should == "Noe"
      thehash.version.should == Noe::VERSION
      thehash.subhash.entry.should == 12
      thehash.subarray[0].entry.should == 12
    end
    
    it "should not be recursive if explicitely said" do
      thehash.methodize!(false)
      thehash.name.should == "Noe"
      thehash.version.should == Noe::VERSION
      thehash.subhash.should == {'entry' => 12}
      lambda{ thehash.subhash.entry }.should raise_error
    end
    
  end
end # module Noe

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
noe-1.7.6 spec/unit/ext/hash/methodize_spec.rb
noe-1.7.5 spec/unit/ext/hash/methodize_spec.rb
noe-1.7.4 spec/unit/ext/hash/methodize_spec.rb