test/unit/xml_object_test.rb in roxml-3.3.1 vs test/unit/xml_object_test.rb in roxml-4.0.0
- old
+ new
@@ -1,7 +1,8 @@
# encoding: utf-8
require_relative './../test_helper'
+require 'minitest/autorun'
class EmptyCart
include ROXML
xml_reader :id
@@ -15,11 +16,11 @@
include ROXML
xml_reader :cart, :as => EmptyCart, :required => true
end
-class TestXMLObject < ActiveSupport::TestCase
+class TestXMLObject < Minitest::Test
# Test book with text and attribute
def test_book_author_text_attribute
book = BookWithAuthorTextAttribute.from_xml(fixture(:book_text_with_attribute))
assert_equal("primary",book.author.role)
assert_equal("David Thomas",book.author.text)
@@ -61,14 +62,14 @@
book_one.contributors = [contrib]
# this book should be completely empty
book_two = WriteableBookWithContributors.new
- assert_equal(nil, book_two.isbn)
- assert_equal(nil, book_two.title)
- assert_equal(nil, book_two.description)
- assert_equal(nil, book_two.contributors)
+ assert_nil book_two.isbn
+ assert_nil book_two.title
+ assert_nil book_two.description
+ assert_equal [], book_two.contributors
end
# Test XML object containing one other XML object (one-to-one)
# In this case, book with publisher
def test_one_to_one
@@ -112,11 +113,11 @@
def test_with_recursion
p = PersonWithMother.from_xml(fixture(:person_with_mothers))
assert_equal 'Ben Franklin', p.name
assert_equal 'Abiah Folger', p.mother.name
assert_equal 'Madeup Mother', p.mother.mother.name
- assert_equal nil, p.mother.mother.mother
+ assert_nil p.mother.mother.mother
end
class Node
include ROXML
@@ -179,10 +180,10 @@
def test_with_guarded_recursion
p = PersonWithGuardedMother.from_xml(fixture(:person_with_guarded_mothers))
assert_equal 'Ben "Benji" Franklin', p.name
assert_equal 'Abiah \'Abby\' Folger', p.mother.name
assert_equal 'Madeup Mother < the third >', p.mother.mother.name
- assert_equal nil, p.mother.mother.mother
+ assert_nil p.mother.mother.mother
end
def test_recursive_with_default_initialization
p = PersonWithMotherOrMissing.from_xml(fixture(:person_with_mothers))
assert_equal 'Unknown', p.mother.mother.mother.name