roxml 3.2.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +13 -0
  3. data/Gemfile +9 -6
  4. data/Gemfile.lock +98 -40
  5. data/History.txt +15 -2
  6. data/README.rdoc +3 -2
  7. data/Rakefile +11 -23
  8. data/VERSION +1 -1
  9. data/examples/person.rb +28 -0
  10. data/examples/search_query.rb +17 -0
  11. data/examples/xml/person.xml +14 -0
  12. data/lib/roxml.rb +10 -4
  13. data/lib/roxml/definition.rb +3 -8
  14. data/lib/roxml/xml/parsers/libxml.rb +11 -27
  15. data/lib/roxml/xml/parsers/nokogiri.rb +13 -26
  16. data/lib/roxml/xml/references.rb +35 -20
  17. data/roxml.gemspec +43 -45
  18. data/spec/definition_spec.rb +79 -103
  19. data/spec/examples/active_record_spec.rb +13 -13
  20. data/spec/examples/amazon_spec.rb +13 -13
  21. data/spec/examples/current_weather_spec.rb +6 -6
  22. data/spec/examples/dashed_elements_spec.rb +3 -3
  23. data/spec/examples/library_spec.rb +3 -3
  24. data/spec/examples/library_with_fines_spec.rb +7 -7
  25. data/spec/examples/person_spec.rb +37 -0
  26. data/spec/examples/post_spec.rb +4 -4
  27. data/spec/examples/search_query_spec.rb +26 -0
  28. data/spec/examples/twitter_spec.rb +4 -4
  29. data/spec/reference_spec.rb +2 -2
  30. data/spec/regression_spec.rb +13 -8
  31. data/spec/roxml_spec.rb +56 -61
  32. data/spec/shared_specs.rb +2 -2
  33. data/spec/spec_helper.rb +2 -0
  34. data/spec/xml/array_spec.rb +2 -2
  35. data/spec/xml/attributes_spec.rb +7 -7
  36. data/spec/xml/encoding_spec.rb +9 -9
  37. data/spec/xml/namespace_spec.rb +40 -21
  38. data/spec/xml/namespaces_spec.rb +3 -3
  39. data/spec/xml/object_spec.rb +7 -7
  40. data/spec/xml/parser_spec.rb +2 -8
  41. data/spec/xml/text_spec.rb +6 -6
  42. data/test/fixtures/book_with_octal_pages.xml +2 -3
  43. data/test/test_helper.rb +1 -2
  44. data/test/unit/definition_test.rb +26 -27
  45. data/test/unit/deprecations_test.rb +23 -2
  46. data/test/unit/to_xml_test.rb +9 -9
  47. data/test/unit/xml_attribute_test.rb +3 -2
  48. data/test/unit/xml_block_test.rb +3 -2
  49. data/test/unit/xml_bool_test.rb +7 -8
  50. data/test/unit/xml_convention_test.rb +4 -3
  51. data/test/unit/xml_hash_test.rb +5 -13
  52. data/test/unit/xml_initialize_test.rb +4 -3
  53. data/test/unit/xml_name_test.rb +3 -2
  54. data/test/unit/xml_namespace_test.rb +4 -3
  55. data/test/unit/xml_object_test.rb +8 -7
  56. data/test/unit/xml_required_test.rb +7 -6
  57. data/test/unit/xml_text_test.rb +3 -2
  58. data/website/index.html +11 -11
  59. metadata +117 -61
  60. data/test/load_test.rb +0 -6
@@ -1,6 +1,7 @@
1
1
  require_relative './../test_helper'
2
+ require 'minitest/autorun'
2
3
 
3
- class TestDefaultXMLNamespaces < ActiveSupport::TestCase
4
+ class TestDefaultXMLNamespaces < Minitest::Test
4
5
  def setup
5
6
  @book = BookWithContributions.from_xml(fixture(:book_with_default_namespace))
6
7
  end
@@ -22,9 +23,9 @@ class TestDefaultXMLNamespaces < ActiveSupport::TestCase
22
23
  xml = LibXML::XML::Parser.string(
23
24
  '<container xmlns="http://defaultnamespace.org"><node>Yeah, content</node><node><subnode>Another</subnode></node></container>').parse
24
25
 
25
- assert_equal nil, xml.find_first('node')
26
+ assert_nil xml.find_first('node')
26
27
  assert_equal "Yeah, content", xml.find_first('ns:node', 'ns:http://defaultnamespace.org').content
27
- assert_equal nil, xml.find_first('ns:node/subnode', 'ns:http://defaultnamespace.org')
28
+ assert_nil xml.find_first('ns:node/subnode', 'ns:http://defaultnamespace.org')
28
29
  assert_equal "Another", xml.find_first('ns:node/ns:subnode', 'ns:http://defaultnamespace.org').content
29
30
  rescue LoadError
30
31
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require_relative './../test_helper'
3
+ require 'minitest/autorun'
3
4
 
4
5
  class EmptyCart
5
6
  include ROXML
@@ -17,7 +18,7 @@ class CartHolder
17
18
  xml_reader :cart, :as => EmptyCart, :required => true
18
19
  end
19
20
 
20
- class TestXMLObject < ActiveSupport::TestCase
21
+ class TestXMLObject < Minitest::Test
21
22
  # Test book with text and attribute
22
23
  def test_book_author_text_attribute
23
24
  book = BookWithAuthorTextAttribute.from_xml(fixture(:book_text_with_attribute))
@@ -63,10 +64,10 @@ class TestXMLObject < ActiveSupport::TestCase
63
64
  # this book should be completely empty
64
65
  book_two = WriteableBookWithContributors.new
65
66
 
66
- assert_equal(nil, book_two.isbn)
67
- assert_equal(nil, book_two.title)
68
- assert_equal(nil, book_two.description)
69
- assert_equal(nil, book_two.contributors)
67
+ assert_nil book_two.isbn
68
+ assert_nil book_two.title
69
+ assert_nil book_two.description
70
+ assert_equal [], book_two.contributors
70
71
  end
71
72
 
72
73
  # Test XML object containing one other XML object (one-to-one)
@@ -114,7 +115,7 @@ class TestXMLObject < ActiveSupport::TestCase
114
115
  assert_equal 'Ben Franklin', p.name
115
116
  assert_equal 'Abiah Folger', p.mother.name
116
117
  assert_equal 'Madeup Mother', p.mother.mother.name
117
- assert_equal nil, p.mother.mother.mother
118
+ assert_nil p.mother.mother.mother
118
119
  end
119
120
 
120
121
  class Node
@@ -181,7 +182,7 @@ HERE
181
182
  assert_equal 'Ben "Benji" Franklin', p.name
182
183
  assert_equal 'Abiah \'Abby\' Folger', p.mother.name
183
184
  assert_equal 'Madeup Mother < the third >', p.mother.mother.name
184
- assert_equal nil, p.mother.mother.mother
185
+ assert_nil p.mother.mother.mother
185
186
  end
186
187
 
187
188
  def test_recursive_with_default_initialization
@@ -1,6 +1,7 @@
1
1
  require_relative './../test_helper'
2
+ require 'minitest/autorun'
2
3
 
3
- class TestXMLRequired < ActiveSupport::TestCase
4
+ class TestXMLRequired < Minitest::Test
4
5
  def setup
5
6
  @full_book = <<BOOK
6
7
  <book ISBN="1234">
@@ -69,26 +70,26 @@ BOOK
69
70
  end
70
71
 
71
72
  def test_required_throws_on_attr_absence
72
- assert_raise ROXML::RequiredElementMissing do
73
+ assert_raises ROXML::RequiredElementMissing do
73
74
  BookWithRequired.from_xml(@book_missing_attr)
74
75
  end
75
76
  end
76
77
 
77
78
  def test_required_throws_on_text_absence
78
- assert_raise ROXML::RequiredElementMissing do
79
+ assert_raises ROXML::RequiredElementMissing do
79
80
  BookWithRequired.from_xml(@book_missing_text)
80
81
  end
81
82
  end
82
83
 
83
84
  def test_required_throws_on_array_absence
84
- assert_raise ROXML::RequiredElementMissing do
85
+ assert_raises ROXML::RequiredElementMissing do
85
86
  BookWithRequired.from_xml(@book_missing_array)
86
87
  end
87
88
  end
88
89
 
89
90
  def test_required_throws_on_hash_absence
90
- assert_raise ROXML::RequiredElementMissing do
91
+ assert_raises ROXML::RequiredElementMissing do
91
92
  BookWithRequired.from_xml(@book_missing_hash)
92
93
  end
93
94
  end
94
- end
95
+ end
@@ -1,6 +1,7 @@
1
1
  require_relative './../test_helper'
2
+ require 'minitest/autorun'
2
3
 
3
- class TestXMLText < ActiveSupport::TestCase
4
+ class TestXMLText < Minitest::Test
4
5
  # Test a simple mapping with no composition
5
6
  def test_valid_simple
6
7
  book = Book.from_xml(fixture(:book_valid))
@@ -68,4 +69,4 @@ class TestXMLText < ActiveSupport::TestCase
68
69
  assert_equal "Just junk... really", n.content
69
70
  assert_equal "Cartwheel", n.name
70
71
  end
71
- end
72
+ end
@@ -6,12 +6,12 @@
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
7
 
8
8
  <title>Empact/roxml @ GitHub</title>
9
-
9
+
10
10
  <style type="text/css">
11
11
  body {
12
12
  margin-top: 1.0em;
13
13
  background-color: #baafdb;
14
- font-family: "helvetica";
14
+ font-family: "helvetica";
15
15
  color: #000000;
16
16
  }
17
17
  #container {
@@ -30,12 +30,12 @@
30
30
  hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
31
31
  .footer { text-align:center; padding-top:30px; font-style: italic; }
32
32
  </style>
33
-
33
+
34
34
  </head>
35
35
 
36
36
  <body>
37
37
  <a href="http://github.com/Empact/roxml"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
38
-
38
+
39
39
  <div id="container">
40
40
 
41
41
  <div class="download">
@@ -44,8 +44,8 @@
44
44
  <a href="http://github.com/Empact/roxml/tarball/master">
45
45
  <img border="0" width="90" src="http://github.com/images/modules/download/tar.png"></a>
46
46
  </div>
47
-
48
- <h1><a href="http://github.com/Empact/roxml">roxml</a>
47
+
48
+ <h1><a href="http://github.com/Empact/roxml">roxml</a>
49
49
  <span class="small">by <a href="http://github.com/Empact">Empact</a></small></h1>
50
50
 
51
51
  <div class="description">
@@ -59,9 +59,9 @@ Use xpath-based xml declarations to map an XML response into an extensible objec
59
59
  Aside from the basics, ROXML has a lot of little goodies to make these definitions minimal and readable, which are worth digging in for. See the 'xml_convention' method for easily referencing xml which uses other naming conventions. See the handling of '?' in accessor names, the application of blocks and such for other manipulations.
60
60
 
61
61
  And finally, if you use this library, feel free to push code back my way. I'll be looking forward to it.</p><h2>Dependencies</h2>
62
- <p>activesupport >= 2.1.0</p>
62
+ <p>activesupport >= 4.0</p>
63
63
  <h2>Install</h2>
64
- <p>'gem install roxml' will install the latest stable <a href="http://rubyforge.org/frs/?group_id=305">rubyforge version</a></p>
64
+ <p>'gem install roxml'</p>
65
65
  <h2>License</h2>
66
66
  <p>MIT License</p>
67
67
  <h2>Authors</h2>
@@ -86,13 +86,13 @@ And finally, if you use this library, feel free to push code back my way. I'll
86
86
  by running:
87
87
  <pre>$ git clone git://github.com/Empact/roxml</pre>
88
88
  </p>
89
-
89
+
90
90
  <div class="footer">
91
91
  get the source code on GitHub : <a href="http://github.com/Empact/roxml">Empact/roxml</a>
92
92
  </div>
93
-
93
+
94
94
  </div>
95
95
 
96
-
96
+
97
97
  </body>
98
98
  </html>
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
5
- prerelease:
4
+ version: 4.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben Woosley
@@ -12,100 +11,154 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2012-01-05 00:00:00.000000000Z
14
+ date: 2020-06-10 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: activesupport
19
- requirement: &2165456080 !ruby/object:Gem::Requirement
20
- none: false
18
+ requirement: !ruby/object:Gem::Requirement
21
19
  requirements:
22
- - - ! '>='
20
+ - - ">="
23
21
  - !ruby/object:Gem::Version
24
- version: 2.3.0
22
+ version: '4.0'
25
23
  type: :runtime
26
24
  prerelease: false
27
- version_requirements: *2165456080
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.0'
28
30
  - !ruby/object:Gem::Dependency
29
31
  name: nokogiri
30
- requirement: &2165455600 !ruby/object:Gem::Requirement
31
- none: false
32
+ requirement: !ruby/object:Gem::Requirement
32
33
  requirements:
33
- - - ! '>='
34
+ - - ">="
34
35
  - !ruby/object:Gem::Version
35
36
  version: 1.3.3
36
37
  type: :runtime
37
38
  prerelease: false
38
- version_requirements: *2165455600
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.3
39
44
  - !ruby/object:Gem::Dependency
40
45
  name: rake
41
- requirement: &2165455120 !ruby/object:Gem::Requirement
42
- none: false
46
+ requirement: !ruby/object:Gem::Requirement
43
47
  requirements:
44
- - - ! '>='
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '0.9'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '0.9'
58
+ - !ruby/object:Gem::Dependency
59
+ name: juwelier
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
45
63
  - !ruby/object:Gem::Version
46
64
  version: '0'
47
65
  type: :development
48
66
  prerelease: false
49
- version_requirements: *2165455120
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
50
72
  - !ruby/object:Gem::Dependency
51
- name: jeweler
52
- requirement: &2165454640 !ruby/object:Gem::Requirement
53
- none: false
73
+ name: minitest
74
+ requirement: !ruby/object:Gem::Requirement
54
75
  requirements:
55
- - - ! '>='
76
+ - - ">="
56
77
  - !ruby/object:Gem::Version
57
78
  version: '0'
58
79
  type: :development
59
80
  prerelease: false
60
- version_requirements: *2165454640
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
61
86
  - !ruby/object:Gem::Dependency
62
87
  name: rspec
63
- requirement: &2165454160 !ruby/object:Gem::Requirement
64
- none: false
88
+ requirement: !ruby/object:Gem::Requirement
65
89
  requirements:
66
- - - ! '>='
90
+ - - "~>"
67
91
  - !ruby/object:Gem::Version
68
- version: 2.0.0
92
+ version: 3.7.0
69
93
  type: :development
70
94
  prerelease: false
71
- version_requirements: *2165454160
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 3.7.0
72
100
  - !ruby/object:Gem::Dependency
73
- name: sqlite3-ruby
74
- requirement: &2165453680 !ruby/object:Gem::Requirement
75
- none: false
101
+ name: sqlite3
102
+ requirement: !ruby/object:Gem::Requirement
76
103
  requirements:
77
- - - ! '>='
104
+ - - ">="
78
105
  - !ruby/object:Gem::Version
79
106
  version: 1.2.4
80
107
  type: :development
81
108
  prerelease: false
82
- version_requirements: *2165453680
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 1.2.4
83
114
  - !ruby/object:Gem::Dependency
84
115
  name: activerecord
85
- requirement: &2165453200 !ruby/object:Gem::Requirement
86
- none: false
116
+ requirement: !ruby/object:Gem::Requirement
87
117
  requirements:
88
- - - ! '>='
118
+ - - ">="
89
119
  - !ruby/object:Gem::Version
90
- version: 2.2.2
120
+ version: '4.0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '4.0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: rack
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - "<"
133
+ - !ruby/object:Gem::Version
134
+ version: 2.0.0
91
135
  type: :development
92
136
  prerelease: false
93
- version_requirements: *2165453200
94
- description: ! 'ROXML is a Ruby library designed to make it easier for Ruby developers
95
- to work with XML.
96
-
97
- Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes
98
- care
99
-
100
- of the marshalling and unmarshalling of mapped attributes so that developers can
101
- focus on
102
-
103
- building first-class Ruby classes. As a result, ROXML simplifies the development
104
- of
105
-
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - "<"
140
+ - !ruby/object:Gem::Version
141
+ version: 2.0.0
142
+ - !ruby/object:Gem::Dependency
143
+ name: equivalent-xml
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 0.6.0
149
+ type: :development
150
+ prerelease: false
151
+ version_requirements: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 0.6.0
156
+ description: |
157
+ ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML.
158
+ Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes care
159
+ of the marshalling and unmarshalling of mapped attributes so that developers can focus on
160
+ building first-class Ruby classes. As a result, ROXML simplifies the development of
106
161
  RESTful applications, Web Services, and XML-RPC.
107
-
108
- '
109
162
  email: ben.woosley@gmail.com
110
163
  executables: []
111
164
  extensions: []
@@ -113,8 +166,9 @@ extra_rdoc_files:
113
166
  - History.txt
114
167
  - README.rdoc
115
168
  files:
116
- - .gitmodules
117
- - .rspec
169
+ - ".gitmodules"
170
+ - ".rspec"
171
+ - ".travis.yml"
118
172
  - Gemfile
119
173
  - Gemfile.lock
120
174
  - History.txt
@@ -128,14 +182,17 @@ files:
128
182
  - examples/dashed_elements.rb
129
183
  - examples/library.rb
130
184
  - examples/library_with_fines.rb
185
+ - examples/person.rb
131
186
  - examples/posts.rb
132
187
  - examples/rails.rb
188
+ - examples/search_query.rb
133
189
  - examples/twitter.rb
134
190
  - examples/xml/active_record.xml
135
191
  - examples/xml/amazon.xml
136
192
  - examples/xml/current_weather.xml
137
193
  - examples/xml/dashed_elements.xml
138
194
  - examples/xml/library_with_fines.xml
195
+ - examples/xml/person.xml
139
196
  - examples/xml/posts.xml
140
197
  - examples/xml/twitter.xml
141
198
  - lib/roxml.rb
@@ -153,7 +210,9 @@ files:
153
210
  - spec/examples/dashed_elements_spec.rb
154
211
  - spec/examples/library_spec.rb
155
212
  - spec/examples/library_with_fines_spec.rb
213
+ - spec/examples/person_spec.rb
156
214
  - spec/examples/post_spec.rb
215
+ - spec/examples/search_query_spec.rb
157
216
  - spec/examples/twitter_spec.rb
158
217
  - spec/reference_spec.rb
159
218
  - spec/regression_spec.rb
@@ -200,7 +259,6 @@ files:
200
259
  - test/fixtures/person.xml
201
260
  - test/fixtures/person_with_guarded_mothers.xml
202
261
  - test/fixtures/person_with_mothers.xml
203
- - test/load_test.rb
204
262
  - test/mocks/dictionaries.rb
205
263
  - test/mocks/mocks.rb
206
264
  - test/support/fixtures.rb
@@ -220,28 +278,26 @@ files:
220
278
  - test/unit/xml_required_test.rb
221
279
  - test/unit/xml_text_test.rb
222
280
  - website/index.html
223
- homepage: http://roxml.rubyforge.org
281
+ homepage: https://github.com/Empact/roxml
224
282
  licenses: []
283
+ metadata: {}
225
284
  post_install_message:
226
285
  rdoc_options: []
227
286
  require_paths:
228
287
  - lib
229
288
  required_ruby_version: !ruby/object:Gem::Requirement
230
- none: false
231
289
  requirements:
232
- - - ! '>='
290
+ - - ">="
233
291
  - !ruby/object:Gem::Version
234
292
  version: '0'
235
293
  required_rubygems_version: !ruby/object:Gem::Requirement
236
- none: false
237
294
  requirements:
238
- - - ! '>='
295
+ - - ">="
239
296
  - !ruby/object:Gem::Version
240
297
  version: '0'
241
298
  requirements: []
242
- rubyforge_project: roxml
243
- rubygems_version: 1.8.8
299
+ rubygems_version: 3.1.2
244
300
  signing_key:
245
- specification_version: 3
301
+ specification_version: 4
246
302
  summary: Ruby Object to XML mapping library
247
303
  test_files: []