Sha256: 0391e6dab37e8aa5dfc190739f469ec69ead9f19f6d206597d0798ac29b5bf64

Contents?: true

Size: 657 Bytes

Versions: 2

Compression:

Stored size: 657 Bytes

Contents

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

class TestXMLAttribute < Test::Unit::TestCase
  def test_initialize_is_run
    m = Measurement.parse('<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.parse(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.parse(fixture(:book_with_depth))
    assert_equal Measurement.new(11.3, 'meters'), b.depth
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Empact-roxml-2.0 test/unit/xml_construct_test.rb
Empact-roxml-2.1 test/unit/xml_construct_test.rb