Skip to content

Commit

Permalink
Revert "Disable deprecation warning by the default [Feature #16345]"
Browse files Browse the repository at this point in the history
* This reverts commit 56613b1.
* Instead we should just enable deprecation warnings in MSpec.
  • Loading branch information
eregon committed Sep 30, 2020
1 parent c34152f commit bfd843a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 48 deletions.
16 changes: 7 additions & 9 deletions core/data/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
require_relative '../../spec_helper'

ruby_version_is ""..."3.0" do
describe "Data" do
it "is a subclass of Object" do
suppress_warning do
Data.superclass.should == Object
end
describe "Data" do
it "is a subclass of Object" do
suppress_warning do
Data.superclass.should == Object
end
end

it "is deprecated" do
-> { Data }.should complain(/constant ::Data is deprecated/)
end
it "is deprecated" do
-> { Data }.should complain(/constant ::Data is deprecated/)
end
end
14 changes: 6 additions & 8 deletions core/env/index_spec.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
require_relative '../../spec_helper'
require_relative 'shared/key'

ruby_version_is ""..."3.0" do
describe "ENV.index" do
it_behaves_like :env_key, :index
describe "ENV.index" do
it_behaves_like :env_key, :index

it "warns about deprecation" do
-> do
ENV.index("foo")
end.should complain(/warning: ENV.index is deprecated; use ENV.key/)
end
it "warns about deprecation" do
-> do
ENV.index("foo")
end.should complain(/warning: ENV.index is deprecated; use ENV.key/)
end
end
32 changes: 15 additions & 17 deletions core/integer/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
require_relative '../../spec_helper'

ruby_version_is ""..."3.0" do
describe "Fixnum" do
it "is unified into Integer" do
suppress_warning do
Fixnum.should equal(Integer)
end
describe "Fixnum" do
it "is unified into Integer" do
suppress_warning do
Fixnum.should equal(Integer)
end
end

it "is deprecated" do
-> { Fixnum }.should complain(/constant ::Fixnum is deprecated/)
end
it "is deprecated" do
-> { Fixnum }.should complain(/constant ::Fixnum is deprecated/)
end
end

describe "Bignum" do
it "is unified into Integer" do
suppress_warning do
Bignum.should equal(Integer)
end
describe "Bignum" do
it "is unified into Integer" do
suppress_warning do
Bignum.should equal(Integer)
end
end

it "is deprecated" do
-> { Bignum }.should complain(/constant ::Bignum is deprecated/)
end
it "is deprecated" do
-> { Bignum }.should complain(/constant ::Bignum is deprecated/)
end
end
2 changes: 1 addition & 1 deletion core/kernel/match_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end
end

ruby_version_is "2.6"..."3.0" do
ruby_version_is "2.6" do
it "is deprecated" do
-> do
Object.new =~ /regexp/
Expand Down
10 changes: 0 additions & 10 deletions core/module/deprecate_constant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
@module.private_constant :PRIVATE
@module.deprecate_constant :PRIVATE
@pattern = /deprecated/
if Warning.respond_to?(:[])
@deprecated = Warning[:deprecated]
Warning[:deprecated] = true
end
end

after :each do
if Warning.respond_to?(:[])
Warning[:deprecated] = @deprecated
end
end

describe "when accessing the deprecated module" do
Expand Down
4 changes: 2 additions & 2 deletions language/predefined_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def foo
-> { $, = Object.new }.should raise_error(TypeError)
end

ruby_version_is "2.7"..."3.0" do
ruby_version_is "2.7" do
it "warns if assigned non-nil" do
-> { $, = "_" }.should complain(/warning: `\$,' is deprecated/)
end
Expand Down Expand Up @@ -693,7 +693,7 @@ def foo
$; = nil
end

ruby_version_is "2.7"..."3.0" do
ruby_version_is "2.7" do
it "warns if assigned non-nil" do
-> { $; = "_" }.should complain(/warning: `\$;' is deprecated/)
end
Expand Down
2 changes: 1 addition & 1 deletion library/net/http/HTTPServerException_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end
end

ruby_version_is "2.6"..."3.0" do
ruby_version_is "2.6" do
describe "Net::HTTPServerException" do
it "is a subclass of Net::ProtoServerError and is warned as deprecated" do
-> { Net::HTTPServerException.should < Net::ProtoServerError }.should complain(/warning: constant Net::HTTPServerException is deprecated/)
Expand Down

0 comments on commit bfd843a

Please sign in to comment.