xqsr3 0.22.2 → 0.22.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 91fb18a7f4ffac6b0ad761c9d41dc29b325f172c
4
- data.tar.gz: 06db1f1fb19d9afed8e77e65c1c4f543af6fdee6
2
+ SHA256:
3
+ metadata.gz: f9ba5e26e05f852e8093d7fad6e1ea1b3aea26e596bac32483b5a0c0ec6176a5
4
+ data.tar.gz: 034b29eb4f8ce8ff96bfe05d98adcdca2c255e8f54ae295daafb00bce93ee942
5
5
  SHA512:
6
- metadata.gz: 265250202da381835bb2a4d8fdde5197293dffc01f0fdf4da89fb51672883ec31ba1f6e1bfe01c2745e5b92dfaff417a50163be63e098bc328f1d82a2189a7d2
7
- data.tar.gz: 85318de93eeb417cee8b49fe45455b19ad8a7d3a5c8d2467edb68b22ac7196c52c79c84a06435ec6ccda5a226e43001cc0594a9540e6f4ea05cb592743330a2a
6
+ metadata.gz: 634f55ac0143b7285caf59a41b06b96f3bc4aaacaa343dc68fdad6372916de3b8d58f5adf23179948ba5bef665c4da1fe6abe285d51925655ffc920f68aa59a1
7
+ data.tar.gz: 90b016538c14a6d7f24e2d3b0e379eacf4b1e33be938ba5f4a7adfa016848d0482d973ab99ae24293c4fecf98839d7c8d799b371f825caef982cd5cb7302086d
@@ -5,7 +5,7 @@
5
5
  # Purpose: Version for Xqsr3 library
6
6
  #
7
7
  # Created: 3rd April 2016
8
- # Updated: 1st February 2018
8
+ # Updated: 28th February 2018
9
9
  #
10
10
  # Home: http://github.com/synesissoftware/xqsr3
11
11
  #
@@ -50,7 +50,7 @@
50
50
  module Xqsr3
51
51
 
52
52
  # Current version of the Xqsr3 library
53
- VERSION = '0.22.2'
53
+ VERSION = '0.22.4'
54
54
 
55
55
  private
56
56
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -6,7 +6,7 @@
6
6
  # module
7
7
  #
8
8
  # Created: 30th July 2017
9
- # Updated: 1st February 2018
9
+ # Updated: 28th February 2018
10
10
  #
11
11
  # Home: http://github.com/synesissoftware/xqsr3
12
12
  #
@@ -170,6 +170,7 @@ module Compare
170
170
  ignore_attributes: false,
171
171
  ignore_attribute_order: true,
172
172
  ignore_child_node_order: true,
173
+ ignore_xml_declarations: true,
173
174
  normalise_whitespace: true,
174
175
  # normalize_whitespace: true,
175
176
  validate_params: true,
@@ -244,6 +245,7 @@ module Compare
244
245
  # +:equate_nil_and_empty+
245
246
  # +:ignore_attributes+
246
247
  # +:ignore_attribute_order+
248
+ # +:ignore_xml_declarations+
247
249
  # +:normalise_whitespace+
248
250
  # +:normalize_whitespace+
249
251
  # +:validate_params+
@@ -289,6 +291,25 @@ module Compare
289
291
  rhs = Nokogiri::XML(rhs) if ::String === rhs
290
292
 
291
293
 
294
+
295
+ # deal with XML Declaration(s)
296
+
297
+ if options[:ignore_xml_declarations]
298
+
299
+ if ::Nokogiri::XML::Document === lhs
300
+
301
+ lhs_root = lhs.root
302
+ lhs = lhs_root if lhs_root
303
+ end
304
+
305
+ if ::Nokogiri::XML::Document === rhs
306
+
307
+ rhs_root = rhs.root
308
+ rhs = rhs_root if rhs_root
309
+ end
310
+ end
311
+
312
+
292
313
  self.xml_compare_nodes_ lhs, rhs, options
293
314
  end
294
315
 
@@ -127,5 +127,62 @@ END_OF_rhs
127
127
  assert r.same?, "#{r.details}"
128
128
  end
129
129
 
130
+ def test_different_declarations_and_dont_ignore
131
+
132
+ lhs_str = <<END_OF_lhs_doc
133
+ <?xml version="1.0"?>
134
+ <outer>
135
+ <mid>
136
+ <inner>some text</inner>
137
+ </mid>
138
+ </outer>
139
+ END_OF_lhs_doc
140
+
141
+ rhs_str = <<END_OF_rhs_doc
142
+ <?xml version="1.0"?>
143
+ <mid>
144
+ <inner>some text</inner>
145
+ </mid>
146
+ END_OF_rhs_doc
147
+
148
+ lhs_doc = Nokogiri::XML lhs_str
149
+ rhs_doc = Nokogiri::XML rhs_str
150
+
151
+ expected = rhs_doc
152
+ actual = lhs_doc.at_xpath('/outer/mid')
153
+
154
+ r = xml_compare expected, actual, normalise_whitespace: true, ignore_xml_declarations: false
155
+
156
+ assert !r.same?
157
+ end
158
+
159
+ def test_different_declarations_and_do_ignore
160
+
161
+ lhs_str = <<END_OF_lhs_doc
162
+ <?xml version="1.0"?>
163
+ <outer>
164
+ <mid>
165
+ <inner>some text</inner>
166
+ </mid>
167
+ </outer>
168
+ END_OF_lhs_doc
169
+
170
+ rhs_str = <<END_OF_rhs_doc
171
+ <?xml version="1.0"?>
172
+ <mid>
173
+ <inner>some text</inner>
174
+ </mid>
175
+ END_OF_rhs_doc
176
+
177
+ lhs_doc = Nokogiri::XML lhs_str
178
+ rhs_doc = Nokogiri::XML rhs_str
179
+
180
+ expected = rhs_doc
181
+ actual = lhs_doc.at_xpath('/outer/mid')
182
+
183
+ r = xml_compare expected, actual, normalise_whitespace: true, ignore_xml_declarations: true
184
+
185
+ assert r.same?, "#{r.details}"
186
+ end
130
187
  end
131
188
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xqsr3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.22.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  eXtensions by fine Quantum for Standard Ruby and 3rd-party libraries is a
@@ -128,7 +128,7 @@ files:
128
128
  - test/unit/xml/utilities/ts_all.rb
129
129
  homepage: http://github.com/synesissoftware/xqsr3
130
130
  licenses:
131
- - 3-clause BSD
131
+ - BSD-3-Clause
132
132
  metadata: {}
133
133
  post_install_message:
134
134
  rdoc_options: []
@@ -136,19 +136,18 @@ require_paths:
136
136
  - lib
137
137
  required_ruby_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - '>='
139
+ - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: '2.0'
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
148
  rubyforge_project:
149
- rubygems_version: 2.4.2
149
+ rubygems_version: 2.7.5
150
150
  signing_key:
151
151
  specification_version: 4
152
152
  summary: xqsr3
153
153
  test_files: []
154
- has_rdoc: