From f5c89c1660afd3a89514125aad579c0a96990c4b Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 14 Dec 2020 20:24:18 +0100 Subject: Deprecate Random::DEFAULT * Closes [Feature #17351]. --- spec/ruby/core/random/default_spec.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'spec') diff --git a/spec/ruby/core/random/default_spec.rb b/spec/ruby/core/random/default_spec.rb index 014cc378a9..a709eddd53 100644 --- a/spec/ruby/core/random/default_spec.rb +++ b/spec/ruby/core/random/default_spec.rb @@ -3,18 +3,30 @@ require_relative '../../spec_helper' 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 -- cgit v1.2.3