libxml-ruby 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/HISTORY +18 -0
  3. data/MANIFEST +34 -34
  4. data/README.rdoc +14 -1
  5. data/Rakefile +18 -8
  6. data/ext/libxml/ruby_xml_error.c +1 -1
  7. data/ext/libxml/ruby_xml_error.h +1 -1
  8. data/ext/libxml/ruby_xml_node.c +15 -16
  9. data/ext/libxml/ruby_xml_reader.c +7 -2
  10. data/ext/libxml/ruby_xml_schema.c +44 -66
  11. data/ext/libxml/ruby_xml_schema_element.c +15 -14
  12. data/ext/libxml/ruby_xml_schema_type.c +66 -93
  13. data/ext/libxml/ruby_xml_version.h +3 -3
  14. data/lib/libxml/schema.rb +0 -19
  15. data/lib/libxml/schema/element.rb +0 -8
  16. data/lib/libxml/schema/type.rb +0 -8
  17. data/libxml-ruby.gemspec +3 -2
  18. data/setup.rb +0 -1
  19. data/test/model/cwm_1_0.xml +11336 -0
  20. data/test/{tc_attr.rb → test_attr.rb} +1 -1
  21. data/test/{tc_attr_decl.rb → test_attr_decl.rb} +1 -1
  22. data/test/{tc_attributes.rb → test_attributes.rb} +1 -1
  23. data/test/{tc_canonicalize.rb → test_canonicalize.rb} +32 -28
  24. data/test/{tc_deprecated_require.rb → test_deprecated_require.rb} +0 -0
  25. data/test/{tc_document.rb → test_document.rb} +3 -3
  26. data/test/{tc_document_write.rb → test_document_write.rb} +1 -1
  27. data/test/{tc_dtd.rb → test_dtd.rb} +6 -6
  28. data/test/{tc_encoding.rb → test_encoding.rb} +6 -3
  29. data/test/{tc_encoding_sax.rb → test_encoding_sax.rb} +1 -1
  30. data/test/{tc_error.rb → test_error.rb} +1 -1
  31. data/test/test_helper.rb +0 -2
  32. data/test/{tc_html_parser.rb → test_html_parser.rb} +3 -2
  33. data/test/{tc_html_parser_context.rb → test_html_parser_context.rb} +1 -1
  34. data/test/{tc_namespace.rb → test_namespace.rb} +3 -4
  35. data/test/{tc_namespaces.rb → test_namespaces.rb} +5 -14
  36. data/test/{tc_node.rb → test_node.rb} +2 -2
  37. data/test/{tc_node_cdata.rb → test_node_cdata.rb} +1 -1
  38. data/test/{tc_node_comment.rb → test_node_comment.rb} +1 -1
  39. data/test/{tc_node_copy.rb → test_node_copy.rb} +2 -3
  40. data/test/{tc_node_edit.rb → test_node_edit.rb} +5 -6
  41. data/test/{tc_node_pi.rb → test_node_pi.rb} +2 -4
  42. data/test/{tc_node_text.rb → test_node_text.rb} +4 -5
  43. data/test/{tc_node_write.rb → test_node_write.rb} +1 -1
  44. data/test/{tc_node_xlink.rb → test_node_xlink.rb} +1 -1
  45. data/test/{tc_parser.rb → test_parser.rb} +7 -6
  46. data/test/{tc_parser_context.rb → test_parser_context.rb} +8 -8
  47. data/test/{tc_properties.rb → test_properties.rb} +1 -1
  48. data/test/{tc_reader.rb → test_reader.rb} +30 -20
  49. data/test/{tc_relaxng.rb → test_relaxng.rb} +2 -2
  50. data/test/{tc_sax_parser.rb → test_sax_parser.rb} +3 -3
  51. data/test/{tc_schema.rb → test_schema.rb} +18 -11
  52. data/test/test_suite.rb +38 -38
  53. data/test/{tc_traversal.rb → test_traversal.rb} +1 -1
  54. data/test/{tc_writer.rb → test_writer.rb} +1 -1
  55. data/test/{tc_xinclude.rb → test_xinclude.rb} +1 -1
  56. data/test/{tc_xml.rb → test_xml.rb} +61 -36
  57. data/test/{tc_xpath.rb → test_xpath.rb} +4 -4
  58. data/test/{tc_xpath_context.rb → test_xpath_context.rb} +1 -1
  59. data/test/{tc_xpath_expression.rb → test_xpath_expression.rb} +2 -2
  60. data/test/{tc_xpointer.rb → test_xpointer.rb} +1 -1
  61. metadata +84 -95
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  class AttrNodeTest < Minitest::Test
6
6
  def setup
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  class AttrDeclTest < Minitest::Test
6
6
  def setup
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  class AttributesTest < Minitest::Test
6
6
  def setup
@@ -1,23 +1,27 @@
1
1
  # encoding: UTF-8
2
- require './test_helper'
2
+ require File.expand_path('../test_helper', __FILE__)
3
3
 
4
4
  class TestCanonicalize < Minitest::Test
5
+ def path(file)
6
+ File.join(File.dirname(__FILE__), file)
7
+ end
8
+
5
9
  # (www.w3.org) 3.1 PIs, Comments, and Outside of Document Element
6
10
  # http://www.w3.org/TR/xml-c14n#Example-OutsideDoc
7
11
  def test_canonicalize_with_w3c_c14n_3_1
8
- given_doc = XML::Document.file('c14n/given/example-1.xml')
12
+ given_doc = XML::Document.file(self.path('c14n/given/example-1.xml'))
9
13
 
10
14
  # With Comments
11
- expected_with_comments = IO.read('c14n/result/with-comments/example-1')
15
+ expected_with_comments = IO.read(self.path('c14n/result/with-comments/example-1'))
12
16
  assert_equal(expected_with_comments, given_doc.canonicalize(:comments => true))
13
17
 
14
18
  # Without Comments
15
- expected_without_comments = IO.read('c14n/result/without-comments/example-1')
19
+ expected_without_comments = IO.read(self.path('c14n/result/without-comments/example-1'))
16
20
  assert_equal(expected_without_comments, given_doc.canonicalize)
17
21
  assert_equal(expected_without_comments, given_doc.canonicalize(:comments => false))
18
22
 
19
23
  # Without Comments (XML_C14N_1_1)
20
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-1')
24
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-1'))
21
25
  mode = XML::Document::XML_C14N_1_1
22
26
  assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
23
27
  end#test_canonicalize_with_w3c_c14n_3_1
@@ -26,11 +30,11 @@ class TestCanonicalize < Minitest::Test
26
30
  # (www.w3.org) 3.2 Whitespace in Document Content
27
31
  # http://www.w3.org/TR/xml-c14n#Example-WhitespaceInContent
28
32
  def test_canonicalize_with_w3c_c14n_3_2
29
- given_doc = XML::Document.file('c14n/given/example-2.xml')
30
- expected = IO.read('c14n/result/without-comments/example-2')
33
+ given_doc = XML::Document.file(self.path('c14n/given/example-2.xml'))
34
+ expected = IO.read(self.path('c14n/result/without-comments/example-2'))
31
35
  assert_equal(expected, given_doc.canonicalize)
32
36
 
33
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-2')
37
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-2'))
34
38
  mode = XML::Document::XML_C14N_1_1
35
39
  assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
36
40
  end
@@ -41,11 +45,11 @@ class TestCanonicalize < Minitest::Test
41
45
  # - Embedded DTD not parsed out of XML, therefore default attributes are
42
46
  # not applied to canonicalization.
43
47
  def test_canonicalize_with_w3c_c14n_3_3
44
- given_doc = XML::Document.file('c14n/given/example-3.xml')
45
- expected = IO.read('c14n/result/without-comments/example-3')
48
+ given_doc = XML::Document.file(self.path('c14n/given/example-3.xml'))
49
+ expected = IO.read(self.path('c14n/result/without-comments/example-3'))
46
50
  assert_equal(expected, given_doc.canonicalize)
47
51
 
48
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-3')
52
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-3'))
49
53
  mode = XML::Document::XML_C14N_1_1
50
54
  assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
51
55
  end
@@ -53,11 +57,11 @@ class TestCanonicalize < Minitest::Test
53
57
  # (www.w3.org) 3.4 Character Modifications and Character References
54
58
  # http://www.w3.org/TR/xml-c14n#Example-Chars
55
59
  def test_canonicalize_with_w3c_c14n_3_4
56
- given_doc = XML::Document.file('c14n/given/example-4.xml')
57
- expected = IO.read('c14n/result/without-comments/example-4')
60
+ given_doc = XML::Document.file(self.path('c14n/given/example-4.xml'))
61
+ expected = IO.read(self.path('c14n/result/without-comments/example-4'))
58
62
  assert_equal(expected, given_doc.canonicalize)
59
63
 
60
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-4')
64
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-4'))
61
65
  mode = XML::Document::XML_C14N_1_1
62
66
  assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
63
67
  end
@@ -67,20 +71,20 @@ class TestCanonicalize < Minitest::Test
67
71
  # (2012-02-20) Failing likely due to a logic error
68
72
  # - libxml2(c14n.c:1788) XML_ENTITY_REF_NODE is invalid node for parsing.
69
73
  def test_canonicalize_with_w3c_c14n_3_5
70
- given_doc = XML::Document.file('c14n/given/example-5.xml')
74
+ #given_doc = XML::Document.file(self.path('c14n/given/example-5.xml'))
71
75
 
72
76
  # With Comments
73
- expected_with_comments = IO.read('c14n/result/with-comments/example-5')
77
+ #expected_with_comments = IO.read(self.path('c14n/result/with-comments/example-5'))
74
78
 
75
79
  # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types.
76
80
  #assert_equal(expected_with_comments, given_doc.canonicalize(:comments => true))
77
81
 
78
82
  # Without Comments
79
- expected_without_comments = IO.read('c14n/result/without-comments/example-5')
83
+ #expected_without_comments = IO.read(self.path('c14n/result/without-comments/example-5'))
80
84
  # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types.
81
85
  #assert_equal(expected_without_comments, given_doc.canonicalize(:comments => false))
82
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-5')
83
- mode = XML::Document::XML_C14N_1_1
86
+ #expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-5'))
87
+ #mode = XML::Document::XML_C14N_1_1
84
88
 
85
89
  # TODO - CANNOT COMPLETE TEST unless libxml2 supports additional node types.
86
90
  #assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
@@ -89,18 +93,18 @@ class TestCanonicalize < Minitest::Test
89
93
  # (www.w3.org) 3.6 UTF-8 Encoding
90
94
  # http://www.w3.org/TR/xml-c14n#Example-UTF8
91
95
  def test_canonicalize_with_w3c_c14n_3_6
92
- given_doc = XML::Document.file('c14n/given/example-6.xml')
96
+ given_doc = XML::Document.file(self.path('c14n/given/example-6.xml'))
93
97
  if defined?(Encoding)
94
- expected = IO.read('c14n/result/without-comments/example-6', :encoding => Encoding::UTF_8)
98
+ expected = IO.read(self.path('c14n/result/without-comments/example-6'), :encoding => Encoding::UTF_8)
95
99
  else
96
- expected = IO.read('c14n/result/without-comments/example-6')
100
+ expected = IO.read(self.path('c14n/result/without-comments/example-6'))
97
101
  end
98
102
  assert_equal(expected, given_doc.canonicalize)
99
103
 
100
104
  if defined?(Encoding)
101
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-6', :encoding => Encoding::UTF_8)
105
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-6'), :encoding => Encoding::UTF_8)
102
106
  else
103
- expected_1_1_without_comments = IO.read('c14n/result/1-1-without-comments/example-6')
107
+ expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-6'))
104
108
  end
105
109
  mode = XML::Document::XML_C14N_1_1
106
110
  assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
@@ -110,13 +114,13 @@ class TestCanonicalize < Minitest::Test
110
114
  # http://www.w3.org/TR/xml-c14n#Example-DocSubsets
111
115
  def test_canonicalize_with_w3c_c14n_3_7
112
116
  # Non Canonicalized Document
113
- given_doc = XML::Document.file('c14n/given/example-7.xml')
114
- expected = IO.read('c14n/result/without-comments/example-7')
117
+ # given_doc = XML::Document.file(self.path('c14n/given/example-7.xml'))
118
+ #expected = IO.read(self.path('c14n/result/without-comments/example-7'))
115
119
 
116
- e1_node = given_doc.find_first('ietf:e1', 'ietf:http://www.ietf.org')
120
+ # e1_node = given_doc.find_first('ietf:e1', 'ietf:http://www.ietf.org')
117
121
 
118
122
  # Select current node, all child nodes, all attributes and namespace nodes
119
- subdoc_nodes = e1_node.find("(.//.|.//@id|namespace::*)")
123
+ #subdoc_nodes = e1_node.find("(.//.|.//@id|namespace::*)")
120
124
 
121
125
  # TODO - This fails because the namespace nodes aren't taken into account
122
126
  # assert_equal(expected, given_doc.canonicalize(:nodes => subdoc_nodes))
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
- require './test_helper'
2
+ require File.expand_path('../test_helper', __FILE__)
3
3
 
4
4
  class TestDocument < Minitest::Test
5
5
  def setup
@@ -26,7 +26,7 @@ class TestDocument < Minitest::Test
26
26
  set = @doc.find('/ruby_array/fixnum')
27
27
  assert_instance_of(XML::XPath::Object, set)
28
28
  assert_raises(NoMethodError) {
29
- xpt = set.xpath
29
+ set.xpath
30
30
  }
31
31
  end
32
32
 
@@ -84,7 +84,7 @@ class TestDocument < Minitest::Test
84
84
  assert(!doc.xhtml?)
85
85
  XML::Dtd.new "-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil, doc, true
86
86
  assert(doc.xhtml?)
87
- end
87
+ end
88
88
 
89
89
  def test_document_root
90
90
  doc1 = LibXML::XML::Document.string("<one/>")
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
  require 'tmpdir'
5
5
 
6
6
  class TestDocumentWrite < Minitest::Test
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
 
6
6
  class TestDtd < Minitest::Test
@@ -42,7 +42,7 @@ class TestDtd < Minitest::Test
42
42
  assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
43
43
  assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
44
44
  assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.system_id
45
- end
45
+ end
46
46
 
47
47
  def test_external_subset
48
48
  xhtml_dtd = XML::Dtd.new "-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", nil
@@ -56,7 +56,7 @@ class TestDtd < Minitest::Test
56
56
  assert_equal "-//W3C//DTD XHTML 1.0 Transitional//EN", xhtml_dtd.external_id
57
57
  assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.uri
58
58
  assert_equal "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xhtml_dtd.system_id
59
- end
59
+ end
60
60
 
61
61
  def test_valid
62
62
  assert(@doc.validate(dtd))
@@ -106,18 +106,18 @@ class TestDtd < Minitest::Test
106
106
  end
107
107
 
108
108
  XML.default_load_external_dtd = false
109
- doc = XML::Parser.string(xml).parse
109
+ XML::Parser.string(xml).parse
110
110
  assert_equal(0, errors.length)
111
111
 
112
112
  errors.clear
113
113
  XML.default_load_external_dtd = true
114
- doc = XML::Parser.string(xml).parse
114
+ XML::Parser.string(xml).parse
115
115
  assert_equal(1, errors.length)
116
116
  assert_equal("Warning: failed to load external entity \"test.dtd\" at :1.",
117
117
  errors[0].to_s)
118
118
 
119
119
  errors = Array.new
120
- doc = XML::Parser.string(xml, :options => XML::Parser::Options::DTDLOAD).parse
120
+ XML::Parser.string(xml, :options => XML::Parser::Options::DTDLOAD).parse
121
121
  assert_equal(1, errors.length)
122
122
  assert_equal("Warning: failed to load external entity \"test.dtd\" at :1.",
123
123
  errors[0].to_s)
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  # Code UTF8 Latin1 Hex
6
6
  # m 109 109 6D
@@ -21,9 +21,14 @@ require './test_helper'
21
21
 
22
22
  class TestEncoding < Minitest::Test
23
23
  def setup
24
+ @original_encoding = Encoding.default_internal
24
25
  Encoding.default_internal = nil
25
26
  end
26
27
 
28
+ def teardown
29
+ Encoding.default_internal = @original_encoding
30
+ end
31
+
27
32
  def file_for_encoding(encoding)
28
33
  file_name = "model/bands.#{encoding.name.downcase}.xml"
29
34
  File.join(File.dirname(__FILE__), file_name)
@@ -55,7 +60,6 @@ class TestEncoding < Minitest::Test
55
60
  end
56
61
 
57
62
  def test_no_internal_encoding_iso_8859_1
58
- Encoding.default_internal = nil
59
63
  load_encoding(Encoding::ISO_8859_1)
60
64
  node = @doc.root.children.first
61
65
 
@@ -93,7 +97,6 @@ class TestEncoding < Minitest::Test
93
97
  end
94
98
 
95
99
  def test_no_internal_encoding_utf_8
96
- Encoding.default_internal = nil
97
100
  load_encoding(Encoding::UTF_8)
98
101
  node = @doc.root.children.first
99
102
 
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
- require './test_helper'
2
+ require File.expand_path('../test_helper', __FILE__)
3
3
 
4
4
  class SaxEncodingCallbacks
5
5
  attr_reader :encoding
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
  require 'stringio'
5
5
 
6
6
  class TestError < Minitest::Test
@@ -12,5 +12,3 @@ $LOAD_PATH << ext
12
12
 
13
13
  require 'xml'
14
14
  require 'minitest/autorun'
15
- #require 'minitest/reporters'
16
- #MiniTest::Reporters.use!
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
  require 'stringio'
5
5
 
6
6
  class HTMLParserTest < Minitest::Test
@@ -154,8 +154,9 @@ class HTMLParserTest < Minitest::Test
154
154
  end
155
155
 
156
156
  def test_open_many_files
157
+ file = File.expand_path(File.join(File.dirname(__FILE__), 'model/ruby-lang.html'))
157
158
  1000.times do
158
- doc = XML::HTMLParser.file('model/ruby-lang.html').parse
159
+ XML::HTMLParser.file(file).parse
159
160
  end
160
161
  end
161
162
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
 
6
6
  class TestHtmlParserContext < Minitest::Test
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
 
6
6
  class TestNS < Minitest::Test
@@ -23,7 +23,7 @@ class TestNS < Minitest::Test
23
23
  def test_create_default_ns
24
24
  node = XML::Node.new('foo')
25
25
  ns = XML::Namespace.new(node, nil, 'http://www.mynamespace.com')
26
- assert_equal(ns.prefix, nil)
26
+ assert_nil(ns.prefix)
27
27
  assert_equal(ns.href, 'http://www.mynamespace.com')
28
28
  end
29
29
 
@@ -44,7 +44,6 @@ class TestNS < Minitest::Test
44
44
 
45
45
  def test_eql
46
46
  node = XML::Node.new('Envelope')
47
- ns = XML::Namespace.new(node, 'soap', 'http://schemas.xmlsoap.org/soap/envelope/')
48
47
 
49
48
  assert(node.namespaces.namespace.eql?(node.namespaces.namespace))
50
49
  end
@@ -58,4 +57,4 @@ class TestNS < Minitest::Test
58
57
 
59
58
  assert(ns1 == ns2)
60
59
  end
61
- end
60
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
 
6
6
  class TestNamespaces < Minitest::Test
@@ -98,7 +98,7 @@ class TestNamespaces < Minitest::Test
98
98
 
99
99
  namespace = namespaces[0]
100
100
  assert_instance_of(XML::Namespace, namespace)
101
- assert_equal(nil, namespace.prefix)
101
+ assert_nil(namespace.prefix)
102
102
  assert_equal('http://services.somewhere.com', namespace.href)
103
103
 
104
104
  namespace = namespaces[1]
@@ -122,15 +122,6 @@ class TestNamespaces < Minitest::Test
122
122
  assert_equal('http://www.w3.org/2001/XMLSchema-instance', namespace.href)
123
123
  end
124
124
 
125
- def test_namespaces
126
- node = @doc.find_first('//ns1:IdAndName',
127
- :ns1 => 'http://domain.somewhere.com')
128
-
129
- node.namespaces.each do |namespace|
130
- assert_instance_of(XML::Namespace, namespace)
131
- end
132
- end
133
-
134
125
  def test_namespace_definitions
135
126
  ns_defs = @doc.root.namespaces.definitions
136
127
  assert_equal(3, ns_defs.size)
@@ -157,7 +148,7 @@ class TestNamespaces < Minitest::Test
157
148
 
158
149
  namespace = ns_defs[0]
159
150
  assert_instance_of(XML::Namespace, namespace)
160
- assert_equal(nil, namespace.prefix)
151
+ assert_nil(namespace.prefix)
161
152
  assert_equal('http://services.somewhere.com', namespace.href)
162
153
  end
163
154
 
@@ -178,7 +169,7 @@ class TestNamespaces < Minitest::Test
178
169
  namespace = node.namespaces.find_by_prefix(nil)
179
170
 
180
171
  assert_instance_of(XML::Namespace, namespace)
181
- assert_equal(nil, namespace.prefix)
172
+ assert_nil(namespace.prefix)
182
173
  assert_equal('http://services.somewhere.com', namespace.href)
183
174
  end
184
175
 
@@ -206,4 +197,4 @@ class TestNamespaces < Minitest::Test
206
197
  node = doc.root.find_first('/soap:Envelope')
207
198
  refute_nil(node)
208
199
  end
209
- end
200
+ end
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  class TestNode < Minitest::Test
6
6
  def setup
@@ -84,7 +84,7 @@ class TestNode < Minitest::Test
84
84
  end
85
85
  end
86
86
 
87
- def test_equality
87
+ def test_equality
88
88
  node_a = @doc.find_first('*[@country]')
89
89
  node_b = @doc.root.child
90
90
 
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test_helper'
3
+ require File.expand_path('../test_helper', __FILE__)
4
4
 
5
5
  class CDataCommentTest < Minitest::Test
6
6
  def setup