Sha256: 702de3970c303ac00ac441a0f44f50125d3ab59e87ddeab67f6663e2a56173a6

Contents?: true

Size: 852 Bytes

Versions: 8

Compression:

Stored size: 852 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)
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

8 entries across 8 versions & 1 rubygems

Version Path
noe-1.7.3 spec/unit/ext/hash/methodize_spec.rb
noe-1.7.2 spec/unit/ext/hash/methodize_spec.rb
noe-1.7.1 spec/unit/ext/hash/methodize_spec.rb
noe-1.7.0 spec/unit/ext/hash/methodize_spec.rb
noe-1.6.0 spec/unit/ext/hash/methodize_spec.rb
noe-1.5.1 spec/unit/ext/hash/methodize_spec.rb
noe-1.5.0 spec/unit/ext/hash/methodize_spec.rb
noe-1.4.0 spec/unit/ext/hash/methodize_spec.rb