File: 0001_fix-spec-and-definition-of-sum.patch

package info (click to toggle)
ruby-powerpack 0.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 492 kB
  • sloc: ruby: 819; makefile: 3
file content (1041 lines) | stat: -rw-r--r-- 31,872 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
Description: Fixing the tests and the definition of sum
Author: Joshua Cavin <cavin9@gmail.com>
Origin: upstream, https://github.com/bbatsov/powerpack/commit/649d4553f5752928c7c2ae36c42ff176c93b2940.patch
Bug: https://github.com/bbatsov/powerpack/pull/30
Bug-Debian: https://bugs.debian.org/888191
Forwarded: not-needed
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2018-03-19

--- ruby-powerpack-0.1.1.orig/lib/powerpack/enumerable/sum.rb
+++ ruby-powerpack-0.1.1/lib/powerpack/enumerable/sum.rb
@@ -12,10 +12,9 @@ unless Enumerable.method_defined? :sum
     #   [1, 2, 3].sum #=> 6
     #   ["a", "b", "c"].sum #=> "abc"
     #   [[1], [2], [3]].sum #=> [1, 2, 3]
-    #   [].sum #=> nil
-    #   [].sum(0) #=> 0
-    def sum(default = nil)
-      reduce(&:+) || default
+    #   [].sum #=> 0
+    def sum
+      reduce(&:+) || 0
     end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/array/butfirst_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/array/butfirst_spec.rb
@@ -1,11 +1,13 @@
 require 'spec_helper'

-describe 'Array#butfirst' do
-  it 'returns an array without the first element' do
-    expect([1, 2, 3].butfirst).to eq([2, 3])
-  end
+unless Array.method_defined? :butfirst
+  describe 'Array#butfirst' do
+    it 'returns an array without the first element' do
+      expect([1, 2, 3].butfirst).to eq([2, 3])
+    end

-  it 'returns nil for empty lists' do
-    expect([].butfirst).to be_nil
+    it 'returns nil for empty lists' do
+      expect([].butfirst).to be_nil
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/array/butlast_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/array/butlast_spec.rb
@@ -1,11 +1,13 @@
 require 'spec_helper'

-describe 'Array#butlast' do
-  it 'returns an array without the last element' do
-    expect([1, 2, 3].butlast).to eq([1, 2])
-  end
+unless Array.method_defined? :butlast
+  describe 'Array#butlast' do
+    it 'returns an array without the last element' do
+      expect([1, 2, 3].butlast).to eq([1, 2])
+    end

-  it 'returns [] for empty lists' do
-    expect([].butlast).to be_empty
+    it 'returns [] for empty lists' do
+      expect([].butlast).to be_empty
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/average_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/average_spec.rb
@@ -1,19 +1,21 @@
 require 'spec_helper'

-describe 'Enumerable#average' do
-  it 'calculates the average of an enum' do
-    expect((1..3).average).to eq(2)
-  end
+unless Enumerable.method_defined? :average
+  describe 'Enumerable#average' do
+    it 'calculates the average of an enum' do
+      expect((1..3).average).to eq(2)
+    end

-  it 'calculates the average of an array' do
-    expect([1, 2, 3, 4].average).to eq(2.5)
-  end
+    it 'calculates the average of an array' do
+      expect([1, 2, 3, 4].average).to eq(2.5)
+    end

-  it 'returns nil when invoked on an empty collection' do
-    expect([].average).to be_nil
-  end
+    it 'returns nil when invoked on an empty collection' do
+      expect([].average).to be_nil
+    end

-  it 'returns default value when invoked on an empty collection' do
-    expect([].average(0)).to be_zero
+    it 'returns default value when invoked on an empty collection' do
+      expect([].average(0)).to be_zero
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/drop_last_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/drop_last_spec.rb
@@ -1,15 +1,17 @@
 require 'spec_helper'

-describe 'Enumerable#drop_last' do
-  it 'drops the last n elements' do
-    expect([1, 2, 3, 4].drop_last(2)).to eq([1, 2])
-  end
+unless Enumerable.method_defined? :drop_last
+  describe 'Enumerable#drop_last' do
+    it 'drops the last n elements' do
+      expect([1, 2, 3, 4].drop_last(2)).to eq([1, 2])
+    end

-  it 'returns an empty array if you request to drop too many elems' do
-    expect((1..10).drop_last(100)).to eq([])
-  end
+    it 'returns an empty array if you request to drop too many elems' do
+      expect((1..10).drop_last(100)).to eq([])
+    end

-  it 'does not accept negative argument' do
-    expect { [1, 2, 3, 4].drop_last(-1) }.to raise_error(ArgumentError)
+    it 'does not accept negative argument' do
+      expect { [1, 2, 3, 4].drop_last(-1) }.to raise_error(ArgumentError)
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/drop_last_while_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/drop_last_while_spec.rb
@@ -1,7 +1,9 @@
 require 'spec_helper'

-describe 'Enumerable#drop_last_while' do
-  it 'drops the last elements while a pred is true' do
-    expect([1, 2, 3, 4, 6].drop_last_while(&:even?)).to eq([1, 2, 3])
+unless Enumerable.method_defined? :drop_last_while
+  describe 'Enumerable#drop_last_while' do
+    it 'drops the last elements while a pred is true' do
+      expect([1, 2, 3, 4, 6].drop_last_while(&:even?)).to eq([1, 2, 3])
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/exactly_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/exactly_spec.rb
@@ -1,39 +1,41 @@
 require 'spec_helper'

-describe 'Enumerable#exactly' do
-  context 'with block' do
-    it 'returns true for exact number of matches' do
-      expect([1, 2, 3, 4].exactly?(2, &:even?)).to be_truthy
-    end
-
-    it 'returns false for less matches' do
-      expect([1, 3, 4].exactly?(2, &:even?)).to be_falsey
-    end
-
-    it 'returns false for more matches' do
-      expect([1, 3, 4, 6, 8].exactly?(2, &:even?)).to be_falsey
-    end
-  end
-
-  context 'without block' do
-    it 'returns true for exact number of non nil/false elements in absence of nil/false elements' do
-      expect([1, 2, 3, 4].exactly?(4)).to be_truthy
-    end
-
-    it 'returns true for exact number of non nil/false elements in presence of nil/false elements' do
-      expect([1, 2, nil, false].exactly?(2)).to be_truthy
-    end
-
-    it 'returns true for exact number of nil/false elements' do
-      expect([nil, false].exactly?(0)).to be_truthy
-    end
-
-    it 'returns false if there are less non nil/false elements in absence of nil/false elements' do
-      expect([1, 2, 3].exactly?(4)).to be_falsey
-    end
-
-    it 'returns false if there are less non nil/false elements in presence of nil/false elements' do
-      expect([1, nil, false].exactly?(4)).to be_falsey
+unless Enumerable.method_defined? :exactly
+  describe 'Enumerable#exactly' do
+    context 'with block' do
+      it 'returns true for exact number of matches' do
+        expect([1, 2, 3, 4].exactly?(2, &:even?)).to be_truthy
+      end
+
+      it 'returns false for less matches' do
+        expect([1, 3, 4].exactly?(2, &:even?)).to be_falsey
+      end
+
+      it 'returns false for more matches' do
+        expect([1, 3, 4, 6, 8].exactly?(2, &:even?)).to be_falsey
+      end
+    end
+
+    context 'without block' do
+      it 'returns true for exact number of non nil/false elements in absence of nil/false elements' do
+        expect([1, 2, 3, 4].exactly?(4)).to be_truthy
+      end
+
+      it 'returns true for exact number of non nil/false elements in presence of nil/false elements' do
+        expect([1, 2, nil, false].exactly?(2)).to be_truthy
+      end
+
+      it 'returns true for exact number of nil/false elements' do
+        expect([nil, false].exactly?(0)).to be_truthy
+      end
+
+      it 'returns false if there are less non nil/false elements in absence of nil/false elements' do
+        expect([1, 2, 3].exactly?(4)).to be_falsey
+      end
+
+      it 'returns false if there are less non nil/false elements in presence of nil/false elements' do
+        expect([1, nil, false].exactly?(4)).to be_falsey
+      end
     end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/frequencies_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/frequencies_spec.rb
@@ -1,20 +1,22 @@
 require 'spec_helper'

-describe 'Enumerable#frequencies' do
-  context 'empty collection' do
-    it 'evaluates to an empty hash' do
-      expect([].frequencies).to eql({})
+unless Enumerable.method_defined? :frequencies
+  describe 'Enumerable#frequencies' do
+    context 'empty collection' do
+      it 'evaluates to an empty hash' do
+        expect([].frequencies).to eql({})
+      end
     end
-  end

-  context 'populated collection' do
-    it 'counts the number of ocurrences and returns a hash in the form value => count' do
-      expect([1, 1, :symbol, 3, 1, :symbol, 'string'].frequencies).to eql(
-        1        => 3,
-        3        => 1,
-        'string' => 1,
-        :symbol  => 2
-      )
+    context 'populated collection' do
+      it 'counts the number of ocurrences and returns a hash in the form value => count' do
+        expect([1, 1, :symbol, 3, 1, :symbol, 'string'].frequencies).to eql(
+          1        => 3,
+          3        => 1,
+          'string' => 1,
+          :symbol  => 2
+        )
+      end
     end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/several_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/several_spec.rb
@@ -1,27 +1,29 @@
 require 'spec_helper'

-describe 'Enumerable#several' do
-  context 'with block' do
-    it 'returns true if more than 1 element matches the predicate' do
-      expect([1, 2, 3, 4].several?(&:even?)).to be_truthy
-    end
+unless Enumerable.method_defined? :several
+  describe 'Enumerable#several' do
+    context 'with block' do
+      it 'returns true if more than 1 element matches the predicate' do
+        expect([1, 2, 3, 4].several?(&:even?)).to be_truthy
+      end

-    it 'returns false if just 1 element matches the predicate' do
-      expect([1, 3, 4].several?(&:even?)).to be_falsey
-    end
+      it 'returns false if just 1 element matches the predicate' do
+        expect([1, 3, 4].several?(&:even?)).to be_falsey
+      end

-    it 'returns false if no elements match the predicate' do
-      expect([1, 3, 4].several?(&:even?)).to be_falsey
+      it 'returns false if no elements match the predicate' do
+        expect([1, 3, 4].several?(&:even?)).to be_falsey
+      end
     end
-  end

-  context 'without block' do
-    it 'returns true if there are 2 or more non nil/false elements' do
-      expect([1, 2, 3, 4].several?).to be_truthy
-    end
+    context 'without block' do
+      it 'returns true if there are 2 or more non nil/false elements' do
+        expect([1, 2, 3, 4].several?).to be_truthy
+      end

-    it 'returns false if there are less than 2 non nil/false elements' do
-      expect([1, nil, false].several?).to be_falsey
+      it 'returns false if there are less than 2 non nil/false elements' do
+        expect([1, nil, false].several?).to be_falsey
+      end
     end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/sum_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/sum_spec.rb
@@ -1,15 +1,21 @@
 require 'spec_helper'

-describe 'Enumerable#sum' do
-  it 'sums up the numbers of an enum' do
-    expect((1..3).sum).to eq(6)
-  end
+unless Enumerable.method_defined? :sum
+  describe 'Enumerable#sum' do
+    it 'sums up the numbers of an enum' do
+      expect((1..3).sum).to eq(6)
+    end

-  it 'returns nil when invoked on an empty collection' do
-    expect([].sum).to be_nil
-  end
+    it 'returns zero when invoked on an empty collection' do
+      expect([].sum).to be_zero
+    end
+
+    it 'returns combined string' do
+      expect(['a', 'b', 'c'].sum).to eq('abc')
+    end

-  it 'returns default value when invoked on an empty collection' do
-    expect([].sum(0)).to be_zero
+    it 'returns flatten array' do
+      expect([[1], [2], [3]].sum).to eq([1, 2, 3])
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/take_last_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/take_last_spec.rb
@@ -1,15 +1,17 @@
 require 'spec_helper'

-describe 'Enumerable#take_last' do
-  it 'takes the last n elements' do
-    expect([1, 2, 3, 4].take_last(2)).to eq([3, 4])
-  end
+unless Enumerable.method_defined? :take_last
+  describe 'Enumerable#take_last' do
+    it 'takes the last n elements' do
+      expect([1, 2, 3, 4].take_last(2)).to eq([3, 4])
+    end

-  it 'returns everything if you request to drop too many elems' do
-    expect((1..10).take_last(100)).to eq((1..10).to_a)
-  end
+    it 'returns everything if you request to drop too many elems' do
+      expect((1..10).take_last(100)).to eq((1..10).to_a)
+    end

-  it 'does not accept negative argument' do
-    expect { [1, 2, 3, 4].take_last(-1) }.to raise_error(ArgumentError)
+    it 'does not accept negative argument' do
+      expect { [1, 2, 3, 4].take_last(-1) }.to raise_error(ArgumentError)
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/enumerable/take_last_while_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/enumerable/take_last_while_spec.rb
@@ -1,7 +1,9 @@
 require 'spec_helper'

-describe 'Enumerable#take_last_while' do
-  it 'takes the last elements while a pred is true' do
-    expect([1, 2, 3, 4, 6].take_last_while(&:even?)).to eq([4, 6])
+unless Enumerable.method_defined? :take_last_while
+  describe 'Enumerable#take_last_while' do
+    it 'takes the last elements while a pred is true' do
+      expect([1, 2, 3, 4, 6].take_last_while(&:even?)).to eq([4, 6])
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/hash/symbolize_keys_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/hash/symbolize_keys_spec.rb
@@ -1,15 +1,17 @@
 require 'spec_helper'

-describe 'Hash#symbolize_keys' do
-  it 'turn the hash keys into symbols' do
-    hash = { 'one' => 1, 'two' => 2 }
+unless Hash.method_defined? :symbolize_keys
+  describe 'Hash#symbolize_keys' do
+    it 'turn the hash keys into symbols' do
+      hash = { 'one' => 1, 'two' => 2 }

-    expect(hash.symbolize_keys).to eq({ one: 1, two: 2 })
-  end
+      expect(hash.symbolize_keys).to eq({ one: 1, two: 2 })
+    end

-  it 'leaves nonconvertible keys untouched' do
-    hash = { 1 => 'one', [1, 1] => 'ones' }
+    it 'leaves nonconvertible keys untouched' do
+      hash = { 1 => 'one', [1, 1] => 'ones' }

-    expect(hash.symbolize_keys).to eq({ 1 => 'one', [1, 1] => 'ones' })
+      expect(hash.symbolize_keys).to eq({ 1 => 'one', [1, 1] => 'ones' })
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/numeric/neg_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/numeric/neg_spec.rb
@@ -1,24 +1,26 @@
 require 'spec_helper'

-describe 'Numeric#neg?' do
-  it 'returns false for positive integer' do
-    expect(1.neg?).to be_falsey
-  end
+unless Numeric.method_defined? :neg?
+  describe 'Numeric#neg?' do
+    it 'returns false for positive integer' do
+      expect(1.neg?).to be_falsey
+    end

-  it 'returns false for positive float' do
-    expect(0.1.neg?).to be_falsey
-  end
+    it 'returns false for positive float' do
+      expect(0.1.neg?).to be_falsey
+    end

-  it 'returns true for negative integer' do
-    expect(-1.neg?).to be_truthy
-  end
+    it 'returns true for negative integer' do
+      expect(-1.neg?).to be_truthy
+    end

-  it 'returns true for negative float' do
-    expect(-0.01.neg?).to be_truthy
-  end
+    it 'returns true for negative float' do
+      expect(-0.01.neg?).to be_truthy
+    end

-  it 'returns false for 0' do
-    expect(0.neg?).to be_falsey
-    expect(0.0.neg?).to be_falsey
+    it 'returns false for 0' do
+      expect(0.neg?).to be_falsey
+      expect(0.0.neg?).to be_falsey
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/numeric/pos_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/numeric/pos_spec.rb
@@ -1,24 +1,26 @@
 require 'spec_helper'

-describe 'Numeric#pos?' do
-  it 'returns true for positive integer' do
-    expect(1.pos?).to be_truthy
-  end
+unless Numeric.method_defined? :pos?
+  describe 'Numeric#pos?' do
+    it 'returns true for positive integer' do
+      expect(1.pos?).to be_truthy
+    end

-  it 'returns true for positive float' do
-    expect(0.1.pos?).to be_truthy
-  end
+    it 'returns true for positive float' do
+      expect(0.1.pos?).to be_truthy
+    end

-  it 'returns false for negative integer' do
-    expect(-1.pos?).to be_falsey
-  end
+    it 'returns false for negative integer' do
+      expect(-1.pos?).to be_falsey
+    end

-  it 'returns false for negative float' do
-    expect(-0.01.pos?).to be_falsey
-  end
+    it 'returns false for negative float' do
+      expect(-0.01.pos?).to be_falsey
+    end

-  it 'returns false for 0' do
-    expect(0.pos?).to be_falsey
-    expect(0.0.pos?).to be_falsey
+    it 'returns false for 0' do
+      expect(0.pos?).to be_falsey
+      expect(0.0.pos?).to be_falsey
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/numeric/scale_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/numeric/scale_spec.rb
@@ -1,139 +1,141 @@
 require 'spec_helper'

-describe 'Numeric#hundred' do
-  it 'returns positive integer for positive integer' do
-    expect(1.hundred).to eql 100
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.hundred).to eql 10.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.hundred).to eql -100
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.hundred).to eql -10.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.hundred).to eql 0
-    expect(0.0.hundred).to eql 0.0
-  end
-end
-
-describe 'Numeric#thousand' do
-  it 'returns positive integer for positive integer' do
-    expect(1.thousand).to eql 1000
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.thousand).to eql 100.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.thousand).to eql -1000
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.thousand).to eql -100.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.thousand).to eql 0
-    expect(0.0.thousand).to eql 0.0
-  end
-end
-
-describe 'Numeric#million' do
-  it 'returns positive integer for positive integer' do
-    expect(1.million).to eql 1000000
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.million).to eql 100000.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.million).to eql -1000000
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.million).to eql -100000.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.million).to eql 0
-    expect(0.0.million).to eql 0.0
-  end
-end
-
-describe 'Numeric#billion' do
-  it 'returns positive integer for positive integer' do
-    expect(1.billion).to eql 1000000000
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.billion).to eql 100000000.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.billion).to eql -1000000000
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.billion).to eql -100000000.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.billion).to eql 0
-    expect(0.0.billion).to eql 0.0
-  end
-end
-
-describe 'Numeric#trillion' do
-  it 'returns positive integer for positive integer' do
-    expect(1.trillion).to eql 1000000000000
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.trillion).to eql 100000000000.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.trillion).to eql -1000000000000
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.trillion).to eql -100000000000.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.trillion).to eql 0
-    expect(0.0.trillion).to eql 0.0
-  end
-end
-
-describe 'Numeric#quadrillion' do
-  it 'returns positive integer for positive integer' do
-    expect(1.quadrillion).to eql 1000000000000000
-  end
-
-  it 'returns positive float for positive float' do
-    expect(0.1.quadrillion).to eql 100000000000000.0
-  end
-
-  it 'returns false for negative integer' do
-    expect(-1.quadrillion).to eql -1000000000000000
-  end
-
-  it 'returns false for negative float' do
-    expect(-0.1.quadrillion).to eql -100000000000000.0
-  end
-
-  it 'returns 0 for 0' do
-    expect(0.quadrillion).to eql 0
-    expect(0.0.quadrillion).to eql 0.0
+unless Numeric.method_defined? :hundred
+  describe 'Numeric#hundred' do
+    it 'returns positive integer for positive integer' do
+      expect(1.hundred).to eql 100
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.hundred).to eql 10.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.hundred).to eql -100
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.hundred).to eql -10.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.hundred).to eql 0
+      expect(0.0.hundred).to eql 0.0
+    end
+  end
+
+  describe 'Numeric#thousand' do
+    it 'returns positive integer for positive integer' do
+      expect(1.thousand).to eql 1000
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.thousand).to eql 100.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.thousand).to eql -1000
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.thousand).to eql -100.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.thousand).to eql 0
+      expect(0.0.thousand).to eql 0.0
+    end
+  end
+
+  describe 'Numeric#million' do
+    it 'returns positive integer for positive integer' do
+      expect(1.million).to eql 1000000
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.million).to eql 100000.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.million).to eql -1000000
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.million).to eql -100000.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.million).to eql 0
+      expect(0.0.million).to eql 0.0
+    end
+  end
+
+  describe 'Numeric#billion' do
+    it 'returns positive integer for positive integer' do
+      expect(1.billion).to eql 1000000000
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.billion).to eql 100000000.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.billion).to eql -1000000000
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.billion).to eql -100000000.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.billion).to eql 0
+      expect(0.0.billion).to eql 0.0
+    end
+  end
+
+  describe 'Numeric#trillion' do
+    it 'returns positive integer for positive integer' do
+      expect(1.trillion).to eql 1000000000000
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.trillion).to eql 100000000000.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.trillion).to eql -1000000000000
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.trillion).to eql -100000000000.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.trillion).to eql 0
+      expect(0.0.trillion).to eql 0.0
+    end
+  end
+
+  describe 'Numeric#quadrillion' do
+    it 'returns positive integer for positive integer' do
+      expect(1.quadrillion).to eql 1000000000000000
+    end
+
+    it 'returns positive float for positive float' do
+      expect(0.1.quadrillion).to eql 100000000000000.0
+    end
+
+    it 'returns false for negative integer' do
+      expect(-1.quadrillion).to eql -1000000000000000
+    end
+
+    it 'returns false for negative float' do
+      expect(-0.1.quadrillion).to eql -100000000000000.0
+    end
+
+    it 'returns 0 for 0' do
+      expect(0.quadrillion).to eql 0
+      expect(0.0.quadrillion).to eql 0.0
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/ascii_only_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/ascii_only_spec.rb
@@ -2,7 +2,7 @@

 require 'spec_helper'

-unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
+unless String.method_defined? :ascii_only || defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
   describe 'String#ascii_only' do
     it 'returns same value for string with ASCII chars only' do
       expect('abc'.ascii_only).to eq 'abc'
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/blank_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/blank_spec.rb
@@ -1,15 +1,17 @@
 require 'spec_helper'

-describe 'String#blank?' do
-  it 'returns true for an empty string' do
-    expect(''.blank?).to be_truthy
-  end
+unless String.method_defined? :blank?
+  describe 'String#blank?' do
+    it 'returns true for an empty string' do
+      expect(''.blank?).to be_truthy
+    end

-  it 'returns true for a string with only whitespace in it' do
-    expect('     '.blank?).to be_truthy
-  end
+    it 'returns true for a string with only whitespace in it' do
+      expect('     '.blank?).to be_truthy
+    end

-  it 'returns false for a string with non-whitespace chars in it' do
-    expect('   test'.blank?).to be_falsey
+    it 'returns false for a string with non-whitespace chars in it' do
+      expect('   test'.blank?).to be_falsey
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/format_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/format_spec.rb
@@ -1,12 +1,14 @@
 require 'spec_helper'

-describe 'String#format' do
-  it 'behaves like String#%' do
-    expect('%s %s'.format %w(James Bond)).to eq('%s %s' % %w(James Bond))
-  end
+unless String.method_defined? :format
+  describe 'String#format' do
+    it 'behaves like String#%' do
+      expect('%s %s'.format %w(James Bond)).to eq('%s %s' % %w(James Bond))
+    end

-  it 'behaves like Kernel#sprintf' do
-    expect('%s %s'.format %w(James Bond))
-      .to eq(sprintf('%s %s', 'James', 'Bond'))
+    it 'behaves like Kernel#sprintf' do
+      expect('%s %s'.format %w(James Bond))
+        .to eq(sprintf('%s %s', 'James', 'Bond'))
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/remove_prefix_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/remove_prefix_spec.rb
@@ -1,13 +1,15 @@
 require 'spec_helper'

-describe 'String#remove_prefix' do
-  it 'removes a prefix in a string' do
-    expect('Ladies Night'.remove_prefix('Ladies ')).to eq('Night')
+unless String.method_defined? :remove_prefix
+  describe 'String#remove_prefix' do
+    it 'removes a prefix in a string' do
+      expect('Ladies Night'.remove_prefix('Ladies ')).to eq('Night')
+    end
   end
-end

-describe 'String#remove_prefix!' do
-  it 'removes a prefix in a string' do
-    expect('Ladies Night'.remove_prefix!('Ladies ')).to eq('Night')
+  describe 'String#remove_prefix!' do
+    it 'removes a prefix in a string' do
+      expect('Ladies Night'.remove_prefix!('Ladies ')).to eq('Night')
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/remove_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/remove_spec.rb
@@ -1,13 +1,15 @@
 require 'spec_helper'

-describe 'String#remove' do
-  it 'removes all occurrences of a pattern' do
-    expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
+unless String.method_defined? :remove
+  describe 'String#remove' do
+    it 'removes all occurrences of a pattern' do
+      expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
+    end
   end
-end

-describe 'String#remove!' do
-  it 'removes all occurrences of a pattern' do
-    expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
+  describe 'String#remove!' do
+    it 'removes all occurrences of a pattern' do
+      expect('Ladies Night'.remove(/Ladies /)).to eq('Night')
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/remove_suffix_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/remove_suffix_spec.rb
@@ -1,13 +1,15 @@
 require 'spec_helper'

-describe 'String#remove_suffix' do
-  it 'removes a suffix in a string' do
-    expect('Ladies Night'.remove_suffix(' Night')).to eq('Ladies')
+unless String.method_defined? :remove_suffix
+  describe 'String#remove_suffix' do
+    it 'removes a suffix in a string' do
+      expect('Ladies Night'.remove_suffix(' Night')).to eq('Ladies')
+    end
   end
-end

-describe 'String#remove_suffix!' do
-  it 'removes a suffix in a string' do
-    expect('Ladies Night'.remove_suffix!(' Night')).to eq('Ladies')
+  describe 'String#remove_suffix!' do
+    it 'removes a suffix in a string' do
+      expect('Ladies Night'.remove_suffix!(' Night')).to eq('Ladies')
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/squish_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/squish_spec.rb
@@ -1,21 +1,23 @@
 require 'spec_helper'

-describe 'String#squish' do
-  it 'strips leading and trailing whitespace' do
-    expect(' Peter   '.squish).to eq('Peter')
-  end
+unless String.method_defined? :squish
+  describe 'String#squish' do
+    it 'strips leading and trailing whitespace' do
+      expect(' Peter   '.squish).to eq('Peter')
+    end

-  it 'compacts internal whitespace' do
-    expect("Peter\r\n \t   Parker".squish).to eq('Peter Parker')
+    it 'compacts internal whitespace' do
+      expect("Peter\r\n \t   Parker".squish).to eq('Peter Parker')
+    end
   end
-end

-describe 'String#squish!' do
-  it 'strips leading and trailing whitespace' do
-    expect(' Peter   '.squish!).to eq('Peter')
-  end
+  describe 'String#squish!' do
+    it 'strips leading and trailing whitespace' do
+      expect(' Peter   '.squish!).to eq('Peter')
+    end

-  it 'compacts internal whitespace' do
-    expect("Peter\r\n \t   Parker".squish!).to eq('Peter Parker')
+    it 'compacts internal whitespace' do
+      expect("Peter\r\n \t   Parker".squish!).to eq('Peter Parker')
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/strip_indent_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/strip_indent_spec.rb
@@ -1,13 +1,15 @@
 require 'spec_helper'

-describe 'String#strip_indent' do
-  it 'strips leading indent on every line of string' do
-    test = <<-END
-    test
-     test
+unless String.method_defined? :strip_indent
+  describe 'String#strip_indent' do
+    it 'strips leading indent on every line of string' do
+      test = <<-END
       test
-    END
+       test
+        test
+      END

-    expect(test.strip_indent).to eq("test\n test\n  test\n")
+      expect(test.strip_indent).to eq("test\n test\n  test\n")
+    end
   end
 end
--- ruby-powerpack-0.1.1.orig/spec/powerpack/string/strip_margin_spec.rb
+++ ruby-powerpack-0.1.1/spec/powerpack/string/strip_margin_spec.rb
@@ -1,26 +1,28 @@
 require 'spec_helper'

-describe 'String#strip_margin' do
-  it 'strips margin on every line of string' do
-    code = <<-END
-      |def test
-      |  some_method
-      |  other_method
-      |end
-    END
+unless String.method_defined? :strip_margin
+  describe 'String#strip_margin' do
+    it 'strips margin on every line of string' do
+      code = <<-END
+        |def test
+        |  some_method
+        |  other_method
+        |end
+      END

-    expect(code.strip_margin('|'))
-      .to eq("def test\n  some_method\n  other_method\nend\n")
-  end
+      expect(code.strip_margin('|'))
+        .to eq("def test\n  some_method\n  other_method\nend\n")
+    end

-  it 'strips special characters margin from every line' do
-    code = <<-END
-      {{1}}def test
-      {{1}}  some_method
-      {{1}}end
-    END
+    it 'strips special characters margin from every line' do
+      code = <<-END
+        {{1}}def test
+        {{1}}  some_method
+        {{1}}end
+      END

-    expect(code.strip_margin('{{1}}'))
-      .to eq("def test\n  some_method\nend\n")
+      expect(code.strip_margin('{{1}}'))
+        .to eq("def test\n  some_method\nend\n")
+    end
   end
 end