Sha256: e9b4c435fc650e4a713d11b7548366a0928d41857ae39db197b0ac3b4fd23a3e

Contents?: true

Size: 411 Bytes

Versions: 4

Compression:

Stored size: 411 Bytes

Contents

require 'minitest/autorun'
require 'shenanigans/hash/to_ostruct'

class ToOstruct < MiniTest::Unit::TestCase
  def test_simple_hash
    struct = {a: 1, b: 2}.to_ostruct
    assert struct.b == 2
  end

  def test_nested_hash
    struct = {a: 1, b: {c: 3}}.to_ostruct
    assert struct.b.c == 3
  end

  def test_nested_array
    struct = {a: 1, b: [{c: 2}]}.to_ostruct
    assert struct.b.first.c == 2
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shenanigans-1.0.6 test/hash/test_to_ostruct.rb
shenanigans-1.0.5 test/hash/test_to_ostruct.rb
shenanigans-1.0.4 test/hash/test_to_ostruct.rb
shenanigans-1.0.3 test/hash/test_to_ostruct.rb