Sha256: 4c6b01968ed4517c50c882ea643ed3648d4505d2cbc3d78d7eef09c5a0a86c20

Contents?: true

Size: 544 Bytes

Versions: 1

Compression:

Stored size: 544 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe 'random_in' do

  before do
    self.should_receive(:rand).with(4).exactly(4).times.and_return(0, 1, 2, 3)
  end

  it 'works with arrays' do
    (0..3).each do |expect|
      random_in([0, 1, 2, 3]).should == expect
    end
  end

  it 'works with parameter lists' do
    (0..3).each do |expect|
      random_in(0,1,2,3).should == expect
    end
  end

  it 'works with ranges' do
    (0..3).each do |expect|
      random_in(0..3).should == expect
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gists-0.0.1 spec/random_in_spec.rb