mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@519df35
This commit is contained in:
parent
31bb66a19d
commit
1c938a72aa
83 changed files with 1416 additions and 308 deletions
|
@ -1,10 +1,11 @@
|
|||
require_relative '../../spec_helper'
|
||||
require_relative 'fixtures/classes'
|
||||
require_relative 'shared/rand'
|
||||
|
||||
describe "Random.rand" do
|
||||
it "returns a Float if no max argument is passed" do
|
||||
Random.rand.should be_kind_of(Float)
|
||||
end
|
||||
it_behaves_like :random_number, :rand, Random.new
|
||||
it_behaves_like :random_number, :random_number, Random.new
|
||||
it_behaves_like :random_number, :rand, Random
|
||||
|
||||
it "returns a Float >= 0 if no max argument is passed" do
|
||||
floats = 200.times.map { Random.rand }
|
||||
|
@ -24,10 +25,6 @@ describe "Random.rand" do
|
|||
floats_a.should == floats_b
|
||||
end
|
||||
|
||||
it "returns an Integer if an Integer argument is passed" do
|
||||
Random.rand(20).should be_kind_of(Integer)
|
||||
end
|
||||
|
||||
it "returns an Integer >= 0 if an Integer argument is passed" do
|
||||
ints = 200.times.map { Random.rand(34) }
|
||||
ints.min.should >= 0
|
||||
|
@ -221,3 +218,9 @@ describe "Random#rand with Range" do
|
|||
end.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.6" do
|
||||
describe "Random.random_number" do
|
||||
it_behaves_like :random_number, :random_number, Random
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue