Sha256: 8a60c8d92679c925c3acbc672a8274c2e017f8315c6515733ad51a53edb6a74e

Contents?: true

Size: 454 Bytes

Versions: 16

Compression:

Stored size: 454 Bytes

Contents

require 'helper'

class TestStruct < Test::Unit::TestCase
  class MyClass < Struct.new(:name, :id); end

  should "create struct from hash with symbol keys" do
    o = MyClass.from_hash(:name => "name", :id => 1)
    assert_equal "name", o.name
    assert_equal 1, o.id
  end

  should "create struct from hash with string keys" do
    o = MyClass.from_hash("name" => "name", "id" => 1)
    assert_equal "name", o.name
    assert_equal 1, o.id
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
threetaps-client-1.0.14 test/test_struct.rb
threetaps-client-1.0.13 test/test_struct.rb
threetaps-client-1.0.12 test/test_struct.rb
threetaps-client-1.0.11 test/test_struct.rb
threetaps-client-1.0.10 test/test_struct.rb
threetaps-client-1.0.9 test/test_struct.rb
threetaps-client-1.0.8 test/test_struct.rb
threetaps-client-1.0.7 test/test_struct.rb
threetaps-client-1.0.6 test/test_struct.rb
threetaps-client-1.0.5 test/test_struct.rb
threetaps-client-1.0.4 test/test_struct.rb
threetaps-client-1.0.3 test/test_struct.rb
threetaps-client-1.0.2 test/test_struct.rb
threetaps-client-1.0.1 test/test_struct.rb
threetaps-client-1.0.0 test/test_struct.rb
threetaps-client-0.5.1 test/test_struct.rb