roxml 3.3.1 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +7 -0
  3. data/Gemfile +9 -6
  4. data/Gemfile.lock +96 -40
  5. data/History.txt +9 -0
  6. data/README.rdoc +3 -2
  7. data/Rakefile +6 -9
  8. data/VERSION +1 -1
  9. data/examples/search_query.rb +17 -0
  10. data/lib/roxml.rb +8 -2
  11. data/lib/roxml/definition.rb +2 -7
  12. data/lib/roxml/xml/references.rb +22 -7
  13. data/roxml.gemspec +48 -36
  14. data/spec/definition_spec.rb +81 -101
  15. data/spec/examples/active_record_spec.rb +13 -13
  16. data/spec/examples/amazon_spec.rb +13 -13
  17. data/spec/examples/current_weather_spec.rb +6 -6
  18. data/spec/examples/dashed_elements_spec.rb +3 -3
  19. data/spec/examples/library_spec.rb +3 -3
  20. data/spec/examples/library_with_fines_spec.rb +7 -7
  21. data/spec/examples/person_spec.rb +3 -3
  22. data/spec/examples/post_spec.rb +4 -4
  23. data/spec/examples/search_query_spec.rb +26 -0
  24. data/spec/examples/twitter_spec.rb +4 -4
  25. data/spec/reference_spec.rb +2 -2
  26. data/spec/regression_spec.rb +13 -8
  27. data/spec/roxml_spec.rb +30 -43
  28. data/spec/shared_specs.rb +2 -2
  29. data/spec/spec_helper.rb +2 -0
  30. data/spec/xml/array_spec.rb +2 -2
  31. data/spec/xml/attributes_spec.rb +7 -7
  32. data/spec/xml/encoding_spec.rb +9 -9
  33. data/spec/xml/namespace_spec.rb +40 -21
  34. data/spec/xml/namespaces_spec.rb +3 -3
  35. data/spec/xml/object_spec.rb +7 -7
  36. data/spec/xml/parser_spec.rb +2 -2
  37. data/spec/xml/text_spec.rb +6 -6
  38. data/test/fixtures/book_with_octal_pages.xml +2 -3
  39. data/test/test_helper.rb +1 -2
  40. data/test/unit/definition_test.rb +26 -27
  41. data/test/unit/deprecations_test.rb +23 -2
  42. data/test/unit/to_xml_test.rb +7 -7
  43. data/test/unit/xml_attribute_test.rb +3 -2
  44. data/test/unit/xml_block_test.rb +3 -2
  45. data/test/unit/xml_bool_test.rb +7 -8
  46. data/test/unit/xml_convention_test.rb +4 -3
  47. data/test/unit/xml_hash_test.rb +5 -13
  48. data/test/unit/xml_initialize_test.rb +4 -3
  49. data/test/unit/xml_name_test.rb +3 -2
  50. data/test/unit/xml_namespace_test.rb +4 -3
  51. data/test/unit/xml_object_test.rb +8 -7
  52. data/test/unit/xml_required_test.rb +7 -6
  53. data/test/unit/xml_text_test.rb +3 -2
  54. data/website/index.html +11 -11
  55. metadata +115 -60
@@ -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.3.1
5
- prerelease:
4
+ version: 4.0.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-02-10 00:00:00.000000000 Z
14
+ date: 2017-12-02 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: activesupport
19
- requirement: &70250009547600 !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: *70250009547600
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: &70250009546900 !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: *70250009546900
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: &70250009546320 !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: *70250009546320
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: &70250009545720 !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: *70250009545720
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: &70250009544920 !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: *70250009544920
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: &70250009544260 !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: *70250009544260
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: &70250009543720 !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: *70250009543720
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
@@ -131,6 +185,7 @@ files:
131
185
  - examples/person.rb
132
186
  - examples/posts.rb
133
187
  - examples/rails.rb
188
+ - examples/search_query.rb
134
189
  - examples/twitter.rb
135
190
  - examples/xml/active_record.xml
136
191
  - examples/xml/amazon.xml
@@ -157,6 +212,7 @@ files:
157
212
  - spec/examples/library_with_fines_spec.rb
158
213
  - spec/examples/person_spec.rb
159
214
  - spec/examples/post_spec.rb
215
+ - spec/examples/search_query_spec.rb
160
216
  - spec/examples/twitter_spec.rb
161
217
  - spec/reference_spec.rb
162
218
  - spec/regression_spec.rb
@@ -222,28 +278,27 @@ files:
222
278
  - test/unit/xml_required_test.rb
223
279
  - test/unit/xml_text_test.rb
224
280
  - website/index.html
225
- homepage: http://roxml.rubyforge.org
281
+ homepage: https://github.com/Empact/roxml
226
282
  licenses: []
283
+ metadata: {}
227
284
  post_install_message:
228
285
  rdoc_options: []
229
286
  require_paths:
230
287
  - lib
231
288
  required_ruby_version: !ruby/object:Gem::Requirement
232
- none: false
233
289
  requirements:
234
- - - ! '>='
290
+ - - ">="
235
291
  - !ruby/object:Gem::Version
236
292
  version: '0'
237
293
  required_rubygems_version: !ruby/object:Gem::Requirement
238
- none: false
239
294
  requirements:
240
- - - ! '>='
295
+ - - ">="
241
296
  - !ruby/object:Gem::Version
242
297
  version: '0'
243
298
  requirements: []
244
- rubyforge_project: roxml
245
- rubygems_version: 1.8.10
299
+ rubyforge_project:
300
+ rubygems_version: 2.6.11
246
301
  signing_key:
247
- specification_version: 3
302
+ specification_version: 4
248
303
  summary: Ruby Object to XML mapping library
249
304
  test_files: []