Permalink
Browse files

Added implementation spec for Array#shuffle! bug.

  • Loading branch information...
brixen committed Jan 26, 2012
1 parent 419f370 commit 9cb923e0ac1508e91f3c5417ff6b1fbb296d10a7
Showing with 16 additions and 0 deletions.
  1. +16 −0 spec/core/array/shuffle_spec.rb
@@ -0,0 +1,16 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+
+describe "Array#shuffle!" do
+ it "uses correct indexes after a #shift" do
+ # https://github.com/rubinius/rubinius/pull/1527
+ # This spec obviously is tied to the current implementation of
+ # Array#shuffle! using Kernel.rand
+
+ Kernel.stub!(:rand).and_return(1, 0)
+
+ ary = 1, 2, 3
+ ary.shift
+
+ ary.shuffle!.should == [3, 2]
+ end
+end

0 comments on commit 9cb923e

Please sign in to comment.