Skip to content

Commit

Permalink
Deprecate Random::DEFAULT
Browse files Browse the repository at this point in the history
* Closes [Feature #17351].
  • Loading branch information
eregon committed Dec 27, 2020
1 parent 4add087 commit 25d878a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions core/random/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@
describe "Random::DEFAULT" do

it "returns a random number generator" do
Random::DEFAULT.should respond_to(:rand)
suppress_warning do
Random::DEFAULT.should respond_to(:rand)
end
end

ruby_version_is ''...'3.0' do
it "returns a Random instance" do
Random::DEFAULT.should be_an_instance_of(Random)
suppress_warning do
Random::DEFAULT.should be_an_instance_of(Random)
end
end
end

ruby_version_is '3.0' do
it "refers to the Random class" do
Random::DEFAULT.should.equal?(Random)
suppress_warning do
Random::DEFAULT.should.equal?(Random)
end
end

it "is deprecated" do
-> {
Random::DEFAULT.should.equal?(Random)
}.should complain(/constant Random::DEFAULT is deprecated/)
end
end

Expand Down

0 comments on commit 25d878a

Please sign in to comment.