From 0f3493308d1a80e6ca04293b7bf91e99a15a722c Mon Sep 17 00:00:00 2001 From: Sebastien Badia <sbadia@debian.org> Date: Mon, 19 Mar 2018 10:12:01 +0100 Subject: [PATCH] d/patches: Import upstream patch for sum function (Closes: #888191) --- .../0001_fix-spec-and-definition-of-sum.patch | 1041 +++++++++++++++++ debian/patches/series | 1 + 2 files changed, 1042 insertions(+) create mode 100644 debian/patches/0001_fix-spec-and-definition-of-sum.patch create mode 100644 debian/patches/series diff --git a/debian/patches/0001_fix-spec-and-definition-of-sum.patch b/debian/patches/0001_fix-spec-and-definition-of-sum.patch new file mode 100644 index 0000000..b239eb5 --- /dev/null +++ b/debian/patches/0001_fix-spec-and-definition-of-sum.patch @@ -0,0 +1,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 diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..bbc5c1a --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001_fix-spec-and-definition-of-sum.patch -- GitLab