X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=spec%2Funit%2Farray_spec.rb;fp=spec%2Funit%2Farray_spec.rb;h=0000000000000000000000000000000000000000;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=d189922c600bad5048de028381c8a30f06822961;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/spec/unit/array_spec.rb b/spec/unit/array_spec.rb deleted file mode 100755 index d189922..0000000 --- a/spec/unit/array_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env rspec - -require 'spec_helper' - -class Array - describe "#in_groups_of" do - it "should correctly group array members" do - [1,2,3,4,5,6,7,8,9,10].in_groups_of(5).should == [[1,2,3,4,5], [6,7,8,9,10]] - end - - it "should padd missing data with correctly" do - arr = [1,2,3,4,5,6,7,8,9,10] - - arr.in_groups_of(3).should == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, nil, nil]] - arr.in_groups_of(3, 0).should == [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 0, 0]] - arr.in_groups_of(11).should == [[1,2,3,4,5, 6,7,8,9,10, nil]] - arr.in_groups_of(11, 0).should == [[1,2,3,4,5, 6,7,8,9,10, 0]] - end - - it "should indicate when the last abtched was reached" do - arr = [1,2,3,4,5,6,7,8,9,10] - - ctr = 0 - - [1,2,3,4,5,6,7,8,9,10].in_groups_of(3) {|a, last_batch| ctr += 1 unless last_batch} - - ctr.should == 3 - end - end -end