Sha256: a98f0746d25680778fb002bb53e232a3417feb56e2dca7355b108f3ed0b06923
Contents?: true
Size: 625 Bytes
Versions: 15
Compression:
Stored size: 625 Bytes
Contents
describe "Array#unshift" do it "prepends object to the original array" do a = [1, 2, 3] a.unshift("a").should equal(a) a.should == ['a', 1, 2, 3] a.unshift().should equal(a) a.should == ['a', 1, 2, 3] a.unshift(5, 4, 3) a.should == [5, 4, 3, 'a', 1, 2, 3] # shift all but one element a = [1, 2] a.shift a.unshift(3, 4) a.should == [3, 4, 2] # now shift all elements a.shift a.shift a.shift a.unshift(3, 4) a.should == [3, 4] end it "quietly ignores unshifting nothing" do [].unshift().should == [] [].unshift(*[]).should == [] end end
Version data entries
15 entries across 15 versions & 1 rubygems