Sha256: 8ab0031963b5cb865e0935e4e712ca3924a34fe1bb6a722e749a5ad7fef08cc8

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

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

class TestXMLName < Test::Unit::TestCase
  def test_named_books_picked_up
    named = Library.from_xml(fixture(:library))
    assert named.books
    assert_equal :book, named.books.first.tag_name
  end

  def test_nameless_books_missing
    nameless = LibraryWithBooksOfUnderivableName.from_xml(fixture(:library))
    assert nameless.novels.empty?
  end

  def test_tag_name
    assert_equal :dictionary, DictionaryOfTexts.tag_name

    dict = DictionaryOfTexts.from_xml(fixture(:dictionary_of_texts))

    assert_equal :dictionary, dict.tag_name
  end

  def test_tag_refs
    assert_equal 'definition', DictionaryOfTexts.tag_refs.only.name
    assert_equal 'word', DictionaryOfTexts.tag_refs.only.hash.key.name
    assert_equal 'meaning', DictionaryOfTexts.tag_refs.only.hash.value.name

    dict = DictionaryOfTexts.from_xml(fixture(:dictionary_of_texts))

    assert_equal 'definition', dict.tag_refs.only.name
    assert_equal 'word', dict.tag_refs.only.hash.key.name
    assert_equal 'meaning', dict.tag_refs.only.hash.value.name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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