Sha256: d5c9c90b91d30e1ba541c6696c5b6ae4d3563ede52374b460d492a6be3ab0c2b

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

require 'spec_helper'

describe Randomer::Percent do
  before(:each) do
    @percent_list = {
      :a => 900,
      :b => 1000,
      :c => 870,
      :e => 0,
      'd' => 10000,
    }
  end

  it "Pick one by percent list" do
    1000.times do
      result = Randomer::Percent.pick_one @percent_list
      @percent_list.include?(result).should == true
      (result == :e).should == false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
randomer-0.0.4 spec/randomer_percent_spec.rb
randomer-0.0.3 spec/randomer_percent_spec.rb