Sha256: 955e6e86bddecde6bcdb0eff13d8a9149fdb7298e99e938b72013d0ded7472a5

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

describe FairDiceRoll do
  let(:random_number) { FairDiceRoll::RANDOM_NUMBER }

  describe "#rand" do
    it "is guaranteed to be random" do
      expect(rand).to eq(random_number)
      expect(rand(3)).to eq(random_number)
    end
  end

  describe Kernel do
    describe "#rand" do
      it "is guaranteed to be random" do
        expect(Kernel.rand).to eq(random_number)
        expect(Kernel.rand(3)).to eq(random_number)
      end
    end
  end

  describe Random do
    describe ".rand" do
      it "is guaranteed to be random" do
        expect(Random.rand).to eq(random_number)
        expect(Random.rand(3)).to eq(random_number)
      end
    end

    describe "#rand" do
      it "is guaranteed to be random" do
        random = Random.new
        expect(random.rand).to eq(random_number)
        expect(random.rand(3)).to eq(random_number)
      end
    end
  end

  describe SecureRandom do
    describe "#random_number" do
      it "is guaranteed to be random" do
        expect(SecureRandom.random_number).to eq(random_number)
        expect(SecureRandom.random_number(3)).to eq(random_number)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fair_dice_roll-6.0.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-5.1.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-5.1.0.rc1 spec/fair_dice_roll_spec.rb
fair_dice_roll-5.0.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-4.0.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-3.0.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-2.0.0 spec/fair_dice_roll_spec.rb
fair_dice_roll-1.0.0 spec/fair_dice_roll_spec.rb