Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ruby/nokogiri-diff/files/
Date: Sat, 09 Apr 2022 07:38:57
Message-Id: 1649489921.d409e0c2c08907e3b9bf2d13d6e1d7d4e369cb4b.graaff@gentoo
1 commit: d409e0c2c08907e3b9bf2d13d6e1d7d4e369cb4b
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 9 06:55:16 2022 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 9 07:38:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d409e0c2
7
8 dev-ruby/nokogiri-diff: add missing diff
9
10 Closes: https://bugs.gentoo.org/837224
11 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
12
13 .../files/nokogiri-diff-0.2.0-rspec3.patch | 436 +++++++++++++++++++++
14 1 file changed, 436 insertions(+)
15
16 diff --git a/dev-ruby/nokogiri-diff/files/nokogiri-diff-0.2.0-rspec3.patch b/dev-ruby/nokogiri-diff/files/nokogiri-diff-0.2.0-rspec3.patch
17 new file mode 100644
18 index 000000000000..c47bda03ec11
19 --- /dev/null
20 +++ b/dev-ruby/nokogiri-diff/files/nokogiri-diff-0.2.0-rspec3.patch
21 @@ -0,0 +1,436 @@
22 +From 4683f35469dbb69fa291ea35be4e7a74090a8b24 Mon Sep 17 00:00:00 2001
23 +From: Balasankar C <balasankarc@×××××××××.org>
24 +Date: Sat, 28 Nov 2015 17:55:09 +0530
25 +Subject: [PATCH] Port tests to RSpec 3
26 +
27 +---
28 + Rakefile | 2 +-
29 + gemspec.yml | 2 +-
30 + spec/diff_spec.rb | 226 ++++++++++++++++++++++----------------------
31 + spec/spec_helper.rb | 2 +-
32 + 4 files changed, 116 insertions(+), 116 deletions(-)
33 +
34 +diff --git a/Rakefile b/Rakefile
35 +index 1b8a92d..7fb967c 100644
36 +--- a/Rakefile
37 ++++ b/Rakefile
38 +@@ -12,7 +12,7 @@ rescue LoadError => e
39 + end
40 +
41 + begin
42 +- gem 'rspec', '~> 2.4'
43 ++ gem 'rspec', '~> 3.0'
44 + require 'rspec/core/rake_task'
45 +
46 + RSpec::Core::RakeTask.new
47 +diff --git a/gemspec.yml b/gemspec.yml
48 +index 5ae611d..d775248 100644
49 +--- a/gemspec.yml
50 ++++ b/gemspec.yml
51 +@@ -18,5 +18,5 @@ dependencies:
52 +
53 + development_dependencies:
54 + rubygems-tasks: ~> 0.1
55 +- rspec: ~> 2.4
56 ++ rspec: ~> 3.0
57 + yard: ~> 0.7
58 +diff --git a/spec/diff_spec.rb b/spec/diff_spec.rb
59 +index 6450c49..adfaaa8 100644
60 +--- a/spec/diff_spec.rb
61 ++++ b/spec/diff_spec.rb
62 +@@ -21,197 +21,197 @@
63 + let(:removed_attr) { Nokogiri::XML('<div><p>one</p></div>') }
64 +
65 + it "should add #diff to Nokogiri::XML::Docuemnt" do
66 +- doc.should respond_to(:diff)
67 ++ expect(doc).to respond_to(:diff)
68 + end
69 +
70 + it "should add #diff to Nokogiri::XML::Element" do
71 +- added_element.at('div').should respond_to(:diff)
72 ++ expect(added_element.at('div')).to respond_to(:diff)
73 + end
74 +
75 + it "should add #diff to Nokogiri::XML::Text" do
76 +- added_text.at('p/text()').should respond_to(:diff)
77 ++ expect(added_text.at('p/text()')).to respond_to(:diff)
78 + end
79 +
80 + it "should add #diff to Nokogiri::XML::Attr" do
81 +- added_attr.at('p/@id').should respond_to(:diff)
82 ++ expect(added_attr.at('p/@id')).to respond_to(:diff)
83 + end
84 +
85 + it "should not compare the Document objects" do
86 + change = doc.diff(doc).first
87 +
88 +- change[0].should == ' '
89 +- change[1].should == doc.root
90 ++ expect(change[0]).to eq(' ')
91 ++ expect(change[1]).to eq(doc.root)
92 + end
93 +
94 + it "should determine when two different documents are identical" do
95 +- doc.diff(Nokogiri::XML(contents)).all? { |change,node|
96 ++ expect(doc.diff(Nokogiri::XML(contents)).all? { |change,node|
97 + change == ' '
98 +- }.should == true
99 ++ }).to eq(true)
100 + end
101 +
102 + it "should search down within Nokogiri::XML::Document objects" do
103 +- doc.diff(changed_text).any? { |change,node|
104 ++ expect(doc.diff(changed_text).any? { |change,node|
105 + change != ' '
106 +- }.should == true
107 ++ }).to eq(true)
108 + end
109 +
110 + it "should determine when text nodes are added" do
111 + changes = doc.at('div').diff(added_text.at('div')).to_a
112 +
113 +- changes.length.should == 4
114 ++ expect(changes.length).to eq(4)
115 +
116 +- changes[0][0].should == ' '
117 +- changes[0][1].should == doc.at('div')
118 ++ expect(changes[0][0]).to eq(' ')
119 ++ expect(changes[0][1]).to eq(doc.at('div'))
120 +
121 +- changes[1][0].should == ' '
122 +- changes[1][1].should == doc.at('//p')
123 ++ expect(changes[1][0]).to eq(' ')
124 ++ expect(changes[1][1]).to eq(doc.at('//p'))
125 +
126 +- changes[2][0].should == '+'
127 +- changes[2][1].should == added_text.at('//div/text()')
128 ++ expect(changes[2][0]).to eq('+')
129 ++ expect(changes[2][1]).to eq(added_text.at('//div/text()'))
130 +
131 +- changes[3][0].should == ' '
132 +- changes[3][1].should == doc.at('//p/text()')
133 ++ expect(changes[3][0]).to eq(' ')
134 ++ expect(changes[3][1]).to eq(doc.at('//p/text()'))
135 + end
136 +
137 + it "should determine when elements are added" do
138 + changes = doc.at('div').diff(added_element.at('div')).to_a
139 +
140 +- changes.length.should == 5
141 ++ expect(changes.length).to eq(5)
142 +
143 +- changes[0][0].should == ' '
144 +- changes[0][1].should == doc.at('div')
145 ++ expect(changes[0][0]).to eq(' ')
146 ++ expect(changes[0][1]).to eq(doc.at('div'))
147 +
148 +- changes[1][0].should == '+'
149 +- changes[1][1].should == added_element.at('//p[1]')
150 ++ expect(changes[1][0]).to eq('+')
151 ++ expect(changes[1][1]).to eq(added_element.at('//p[1]'))
152 +
153 +- changes[2][0].should == ' '
154 +- changes[2][1].should == doc.at('//p')
155 ++ expect(changes[2][0]).to eq(' ')
156 ++ expect(changes[2][1]).to eq(doc.at('//p'))
157 +
158 +- changes[3][0].should == '-'
159 +- changes[3][1].should == doc.at('//p/text()')
160 ++ expect(changes[3][0]).to eq('-')
161 ++ expect(changes[3][1]).to eq(doc.at('//p/text()'))
162 +
163 +- changes[4][0].should == '+'
164 +- changes[4][1].should == added_element.at('//p[2]/text()')
165 ++ expect(changes[4][0]).to eq('+')
166 ++ expect(changes[4][1]).to eq(added_element.at('//p[2]/text()'))
167 + end
168 +
169 + it "should ignore when attribute order changes" do
170 + changes = added_attrs.at('p').diff(changed_attr_order.at('p')).to_a
171 +
172 +- changes.all? { |change| change[0] == ' ' }.should be_true
173 ++ expect(changes.all? { |change| change[0] == ' ' }).to be_truthy
174 + end
175 +
176 + it "should determine when attributes are added" do
177 + changes = doc.at('p').diff(added_attr.at('p')).to_a
178 +
179 +- changes.length.should == 3
180 ++ expect(changes.length).to eq(3)
181 +
182 +- changes[0][0].should == ' '
183 +- changes[0][1].should == doc.at('p')
184 ++ expect(changes[0][0]).to eq(' ')
185 ++ expect(changes[0][1]).to eq(doc.at('p'))
186 +
187 +- changes[1][0].should == '+'
188 +- changes[1][1].should == added_attr.at('//p/@id')
189 ++ expect(changes[1][0]).to eq('+')
190 ++ expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
191 +
192 +- changes[2][0].should == ' '
193 +- changes[2][1].should == doc.at('//p/text()')
194 ++ expect(changes[2][0]).to eq(' ')
195 ++ expect(changes[2][1]).to eq(doc.at('//p/text()'))
196 + end
197 +
198 + it "should determine when text nodes differ" do
199 + changes = doc.at('p').diff(changed_text.at('p')).to_a
200 +
201 +- changes.length.should == 3
202 ++ expect(changes.length).to eq(3)
203 +
204 +- changes[0][0].should == ' '
205 +- changes[0][1].should == doc.at('p')
206 ++ expect(changes[0][0]).to eq(' ')
207 ++ expect(changes[0][1]).to eq(doc.at('p'))
208 +
209 +- changes[1][0].should == '-'
210 +- changes[1][1].should == doc.at('//p/text()')
211 ++ expect(changes[1][0]).to eq('-')
212 ++ expect(changes[1][1]).to eq(doc.at('//p/text()'))
213 +
214 +- changes[2][0].should == '+'
215 +- changes[2][1].should == changed_text.at('//p/text()')
216 ++ expect(changes[2][0]).to eq('+')
217 ++ expect(changes[2][1]).to eq(changed_text.at('//p/text()'))
218 + end
219 +
220 + it "should determine when element names differ" do
221 + changes = doc.at('div').diff(changed_element.at('div')).to_a
222 +
223 +- changes.length.should == 3
224 ++ expect(changes.length).to eq(3)
225 +
226 +- changes[0][0].should == ' '
227 +- changes[0][1].should == doc.at('div')
228 ++ expect(changes[0][0]).to eq(' ')
229 ++ expect(changes[0][1]).to eq(doc.at('div'))
230 +
231 +- changes[1][0].should == '-'
232 +- changes[1][1].should == doc.at('p')
233 ++ expect(changes[1][0]).to eq('-')
234 ++ expect(changes[1][1]).to eq(doc.at('p'))
235 +
236 +- changes[2][0].should == '+'
237 +- changes[2][1].should == changed_element.at('span')
238 ++ expect(changes[2][0]).to eq('+')
239 ++ expect(changes[2][1]).to eq(changed_element.at('span'))
240 + end
241 +
242 + it "should determine when attribute names differ" do
243 + changes = added_attr.at('p').diff(changed_attr_name.at('p')).to_a
244 +
245 +- changes.length.should == 4
246 ++ expect(changes.length).to eq(4)
247 +
248 +- changes[0][0].should == ' '
249 +- changes[0][1].should == added_attr.at('p')
250 ++ expect(changes[0][0]).to eq(' ')
251 ++ expect(changes[0][1]).to eq(added_attr.at('p'))
252 +
253 +- changes[1][0].should == '-'
254 +- changes[1][1].should == added_attr.at('//p/@id')
255 ++ expect(changes[1][0]).to eq('-')
256 ++ expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
257 +
258 +- changes[2][0].should == '+'
259 +- changes[2][1].should == changed_attr_name.at('//p/@i')
260 ++ expect(changes[2][0]).to eq('+')
261 ++ expect(changes[2][1]).to eq(changed_attr_name.at('//p/@i'))
262 +
263 +- changes[3][0].should == ' '
264 +- changes[3][1].should == added_attr.at('//p/text()')
265 ++ expect(changes[3][0]).to eq(' ')
266 ++ expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
267 + end
268 +
269 + it "should determine when attribute values differ" do
270 + changes = added_attr.at('p').diff(changed_attr_value.at('p')).to_a
271 +
272 +- changes.length.should == 4
273 ++ expect(changes.length).to eq(4)
274 +
275 +- changes[0][0].should == ' '
276 +- changes[0][1].should == added_attr.at('p')
277 ++ expect(changes[0][0]).to eq(' ')
278 ++ expect(changes[0][1]).to eq(added_attr.at('p'))
279 +
280 +- changes[1][0].should == '-'
281 +- changes[1][1].should == added_attr.at('//p/@id')
282 ++ expect(changes[1][0]).to eq('-')
283 ++ expect(changes[1][1]).to eq(added_attr.at('//p/@id'))
284 +
285 +- changes[2][0].should == '+'
286 +- changes[2][1].should == changed_attr_value.at('//p/@id')
287 ++ expect(changes[2][0]).to eq('+')
288 ++ expect(changes[2][1]).to eq(changed_attr_value.at('//p/@id'))
289 +
290 +- changes[3][0].should == ' '
291 +- changes[3][1].should == added_attr.at('//p/text()')
292 ++ expect(changes[3][0]).to eq(' ')
293 ++ expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
294 + end
295 +
296 + it "should determine when text nodes are removed" do
297 + changes = added_text.at('div').diff(removed_text.at('div')).to_a
298 +
299 +- changes.length.should == 4
300 ++ expect(changes.length).to eq(4)
301 +
302 +- changes[0][0].should == ' '
303 +- changes[0][1].should == added_text.at('div')
304 ++ expect(changes[0][0]).to eq(' ')
305 ++ expect(changes[0][1]).to eq(added_text.at('div'))
306 +
307 +- changes[1][0].should == ' '
308 +- changes[1][1].should == added_text.at('p')
309 ++ expect(changes[1][0]).to eq(' ')
310 ++ expect(changes[1][1]).to eq(added_text.at('p'))
311 +
312 +- changes[2][0].should == ' '
313 +- changes[2][1].should == added_text.at('//div/text()')
314 ++ expect(changes[2][0]).to eq(' ')
315 ++ expect(changes[2][1]).to eq(added_text.at('//div/text()'))
316 +
317 +- changes[3][0].should == '-'
318 +- changes[3][1].should == added_text.at('//p/text()')
319 ++ expect(changes[3][0]).to eq('-')
320 ++ expect(changes[3][1]).to eq(added_text.at('//p/text()'))
321 + end
322 +
323 + it "should determine when elements are removed" do
324 + changes = added_element.at('div').diff(removed_element.at('div')).to_a
325 +
326 +- changes.length.should == 3
327 ++ expect(changes.length).to eq(3)
328 +
329 +- changes[0][0].should == ' '
330 +- changes[0][1].should == added_element.at('div')
331 ++ expect(changes[0][0]).to eq(' ')
332 ++ expect(changes[0][1]).to eq(added_element.at('div'))
333 +
334 +- changes[1][0].should == '-'
335 +- changes[1][1].should == added_element.at('//p[1]')
336 ++ expect(changes[1][0]).to eq('-')
337 ++ expect(changes[1][1]).to eq(added_element.at('//p[1]'))
338 +
339 +- changes[2][0].should == '-'
340 +- changes[2][1].should == added_element.at('//p[2]')
341 ++ expect(changes[2][0]).to eq('-')
342 ++ expect(changes[2][1]).to eq(added_element.at('//p[2]'))
343 + end
344 +
345 + it "should ignore when attributes change order" do
346 +@@ -220,47 +220,47 @@
347 + it "should determine when attributes are removed" do
348 + changes = added_attr.at('div').diff(removed_attr.at('div')).to_a
349 +
350 +- changes.length.should == 4
351 ++ expect(changes.length).to eq(4)
352 +
353 +- changes[0][0].should == ' '
354 +- changes[0][1].should == added_attr.at('div')
355 ++ expect(changes[0][0]).to eq(' ')
356 ++ expect(changes[0][1]).to eq(added_attr.at('div'))
357 +
358 +- changes[1][0].should == ' '
359 +- changes[1][1].should == added_attr.at('p')
360 ++ expect(changes[1][0]).to eq(' ')
361 ++ expect(changes[1][1]).to eq(added_attr.at('p'))
362 +
363 +- changes[2][0].should == '-'
364 +- changes[2][1].should == added_attr.at('//p/@id')
365 ++ expect(changes[2][0]).to eq('-')
366 ++ expect(changes[2][1]).to eq(added_attr.at('//p/@id'))
367 +
368 +- changes[3][0].should == ' '
369 +- changes[3][1].should == added_attr.at('//p/text()')
370 ++ expect(changes[3][0]).to eq(' ')
371 ++ expect(changes[3][1]).to eq(added_attr.at('//p/text()'))
372 + end
373 +
374 + context ":added" do
375 + it "should determine only when text nodes are added" do
376 + changes = doc.at('div').diff(added_text.at('div'), :added => true).to_a
377 +
378 +- changes.length.should == 1
379 ++ expect(changes.length).to eq(1)
380 +
381 +- changes[0][0].should == '+'
382 +- changes[0][1].should == added_text.at('//div/text()')
383 ++ expect(changes[0][0]).to eq('+')
384 ++ expect(changes[0][1]).to eq(added_text.at('//div/text()'))
385 + end
386 +
387 + it "should determine only when elements are added" do
388 + changes = doc.at('div').diff(added_element.at('div'), :added => true).to_a
389 +
390 +- changes.length.should == 1
391 ++ expect(changes.length).to eq(1)
392 +
393 +- changes[0][0].should == '+'
394 +- changes[0][1].should == added_element.at('//div/p[2]')
395 ++ expect(changes[0][0]).to eq('+')
396 ++ expect(changes[0][1]).to eq(added_element.at('//div/p[2]'))
397 + end
398 +
399 + it "should determine only when attributes are added" do
400 + changes = doc.at('div').diff(added_attr.at('div'), :added => true).to_a
401 +
402 +- changes.length.should == 1
403 ++ expect(changes.length).to eq(1)
404 +
405 +- changes[0][0].should == '+'
406 +- changes[0][1].should == added_attr.at('//p/@id')
407 ++ expect(changes[0][0]).to eq('+')
408 ++ expect(changes[0][1]).to eq(added_attr.at('//p/@id'))
409 + end
410 + end
411 +
412 +@@ -268,28 +268,28 @@
413 + it "should determine only when text nodes are removed" do
414 + changes = doc.at('div').diff(removed_text.at('div'), :removed => true).to_a
415 +
416 +- changes.length.should == 1
417 ++ expect(changes.length).to eq(1)
418 +
419 +- changes[0][0].should == '-'
420 +- changes[0][1].should == doc.at('//p/text()')
421 ++ expect(changes[0][0]).to eq('-')
422 ++ expect(changes[0][1]).to eq(doc.at('//p/text()'))
423 + end
424 +
425 + it "should determine only when elements are removed" do
426 + changes = doc.at('div').diff(removed_element.at('div'), :removed => true).to_a
427 +
428 +- changes.length.should == 1
429 ++ expect(changes.length).to eq(1)
430 +
431 +- changes[0][0].should == '-'
432 +- changes[0][1].should == doc.at('//div/p')
433 ++ expect(changes[0][0]).to eq('-')
434 ++ expect(changes[0][1]).to eq(doc.at('//div/p'))
435 + end
436 +
437 + it "should determine only when attributes are removed" do
438 + changes = added_attr.at('div').diff(removed_attr.at('div'), :removed => true).to_a
439 +
440 +- changes.length.should == 1
441 ++ expect(changes.length).to eq(1)
442 +
443 +- changes[0][0].should == '-'
444 +- changes[0][1].should == added_attr.at('//p/@id')
445 ++ expect(changes[0][0]).to eq('-')
446 ++ expect(changes[0][1]).to eq(added_attr.at('//p/@id'))
447 + end
448 + end
449 + end
450 +diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
451 +index 4b9ecea..5f26cbb 100644
452 +--- a/spec/spec_helper.rb
453 ++++ b/spec/spec_helper.rb
454 +@@ -1,2 +1,2 @@
455 +-gem 'rspec', '~> 2.4'
456 ++gem 'rspec', '~> 3.0'
457 + require 'rspec'