test/unit/xml_object_test.rb in roxml-2.5.3 vs test/unit/xml_object_test.rb in roxml-3.1.0
- old
+ new
@@ -1,6 +1,6 @@
-require File.join(File.dirname(__FILE__), '..', 'test_helper')
+require 'test/test_helper'
class EmptyCart
include ROXML
xml_reader :id
@@ -11,11 +11,11 @@
end
class CartHolder
include ROXML
- xml_reader :cart, EmptyCart, :required => true
+ xml_reader :cart, :as => EmptyCart, :required => true
end
class TestXMLObject < ActiveSupport::TestCase
# Test book with text and attribute
def test_book_author_text_attribute
@@ -118,27 +118,27 @@
class Node
include ROXML
xml_reader :name, :from => 'node_name'
- xml_reader :nodes, [Node]
+ xml_reader :nodes, :as => [Node]
end
class Taxonomy
include ROXML
xml_reader :name, :from => 'taxonomy_name'
- xml_reader :nodes, [Node]
+ xml_reader :nodes, :as => [Node]
end
class Taxonomies
include ROXML
- xml_reader :taxonomies, [Taxonomy]
+ xml_reader :taxonomies, :as => [Taxonomy]
end
def test_more_recursion
# quiet the error handler
- ROXML::XML::Error.reset_handler
+ ROXML::XML::Error.reset_handler if ROXML::XML::Error.respond_to?(:reset_handler)
taxonomies = Taxonomies.from_xml(<<HERE)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taxonomies SYSTEM "taxonomy.dtd">
<taxonomies>
<taxonomy>