Sha256: 9fdd7ca2545e658f58e7e8bdabc970b8fcaaf3f7267360a655be19fd5e84eb29

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))

class HashableTest < Test::Unit::TestCase
  def test_to_deep_hash
    hash_representation = {
      :blist => [ { :id => 1}, {'b' => { :id => 2 } } ]
    }
    assert_equal(hash_representation, A.new().to_dh)
  end
end

class A
  include Hashable
  attr_accessor :blist
  def initialize
    @blist = [ B.new(1), { 'b' => B.new(2) } ]
  end
end

class B
  include Hashable
  attr_accessor :id
  def initialize(id); @id = id; end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hashable-0.1.2 test/unit/hashable_test.rb
hashable-0.1.1 test/unit/hashable_test.rb
hashable-0.1.0 test/unit/hashable_test.rb