Sha256: 3d696bd224a62179ae6b445b39a3e9771c170c4ebd44c0cd9922a7f59c593a4a

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

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

class TestXMLAttribute < Test::Unit::TestCase
  def test_initialize_is_run
    m = Measurement.from_xml('<measurement units="hundredths-meters">1130</measurement>')
    assert_equal 11.3, m.value
    assert_equal 'meters', m.units
  end

  def test_initialize_is_run_for_nested_type
    b = BookWithDepth.from_xml(fixture(:book_with_depth))
    assert_equal Measurement.new(11.3, 'meters'), b.depth
  end

  def test_initialize_is_run_for_nested_type_with_inheritance
    b = InheritedBookWithDepth.from_xml(fixture(:book_with_depth))
    assert_equal Measurement.new(11.3, 'meters'), b.depth
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Empact-roxml-2.2 test/unit/xml_construct_test.rb