Skip to content

Commit

Permalink
Drop support for Ruby 2.6 which is now EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Apr 25, 2022
1 parent eb098b3 commit 055d83c
Show file tree
Hide file tree
Showing 257 changed files with 3,230 additions and 7,341 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu, macos, windows ]
ruby: [ 2.6.10, 2.7.6, 3.0.4, 3.1.2 ]
ruby: [ 2.7.6, 3.0.4, 3.1.2 ]
runs-on: ${{ matrix.os }}-latest
steps:
- name: git config autocrlf
Expand Down Expand Up @@ -57,6 +57,6 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7
- run: gem install rubocop:0.77.0
- run: rubocop --parallel
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ First, file a bug at https://bugs.ruby-lang.org/.
It is better to use a `ruby_version_is` guard if there was a release with the fix.

```ruby
ruby_bug '#13669', ''...'2.7' do
ruby_bug '#13669', ''...'3.2' do
it "works like this" do
# Specify the expected behavior here, not the bug
end
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ For older specs try these commits:
* Ruby 2.3.8 - [Suite](https://github.com/ruby/spec/commit/dc733114d8ae66a3368ba3a98422c50147a76ba5) using [MSpec](https://github.com/ruby/mspec/commit/4599bc195fb109f2a482a01c32a7d659518369ea)
* Ruby 2.4.10 - [Suite](https://github.com/ruby/spec/commit/bce4f2b81d6c31db67cf4d023a0625ceadde59bd) using [MSpec](https://github.com/ruby/mspec/commit/e7eb8aa4c26495b7b461e687d950b96eb08b3ff2)
* Ruby 2.5.9 - [Suite](https://github.com/ruby/spec/commit/c503335d3d9f6ec6ef24de60a0716c34af69b64f) using [MSpec](https://github.com/ruby/mspec/commit/0091e8a62e954717cd54641f935eaf1403692041)
* Ruby 2.6.10 - [Suite](https://github.com/ruby/spec/commit/aaf998fb8c92c4e63ad423a2e7ca6e6921818c6e) using [MSpec](https://github.com/ruby/mspec/commit/5e36c684e9e2b92b1187589bba1df22c640a8661)

### Running the specs

Expand Down
33 changes: 15 additions & 18 deletions command_line/dash_upper_w_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,26 @@
it_behaves_like :command_line_verbose, "-W2"
end

# Regarding the defaults, see core/warning/element_reference_spec.rb
ruby_version_is "2.7" do
describe "The -W command line option with :deprecated" do
it "enables deprecation warnings" do
ruby_exe('p Warning[:deprecated]', options: '-W:deprecated').should == "true\n"
end
describe "The -W command line option with :deprecated" do
it "enables deprecation warnings" do
ruby_exe('p Warning[:deprecated]', options: '-W:deprecated').should == "true\n"
end
end

describe "The -W command line option with :no-deprecated" do
it "suppresses deprecation warnings" do
ruby_exe('p Warning[:deprecated]', options: '-w -W:no-deprecated').should == "false\n"
end
describe "The -W command line option with :no-deprecated" do
it "suppresses deprecation warnings" do
ruby_exe('p Warning[:deprecated]', options: '-w -W:no-deprecated').should == "false\n"
end
end

describe "The -W command line option with :experimental" do
it "enables experimental warnings" do
ruby_exe('p Warning[:experimental]', options: '-W:experimental').should == "true\n"
end
describe "The -W command line option with :experimental" do
it "enables experimental warnings" do
ruby_exe('p Warning[:experimental]', options: '-W:experimental').should == "true\n"
end
end

describe "The -W command line option with :no-experimental" do
it "suppresses experimental warnings" do
ruby_exe('p Warning[:experimental]', options: '-w -W:no-experimental').should == "false\n"
end
describe "The -W command line option with :no-experimental" do
it "suppresses experimental warnings" do
ruby_exe('p Warning[:experimental]', options: '-w -W:no-experimental').should == "false\n"
end
end
6 changes: 2 additions & 4 deletions command_line/dash_w_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
describe "The -w command line option" do
it_behaves_like :command_line_verbose, "-w"

ruby_version_is "2.7" do
it "enables both deprecated and experimental warnings" do
ruby_exe('p Warning[:deprecated]; p Warning[:experimental]', options: '-w').should == "true\ntrue\n"
end
it "enables both deprecated and experimental warnings" do
ruby_exe('p Warning[:deprecated]; p Warning[:experimental]', options: '-w').should == "true\ntrue\n"
end
end
30 changes: 14 additions & 16 deletions command_line/rubyopt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,22 @@
ruby_exe("p $VERBOSE", escape: true).chomp.should == "true"
end

ruby_version_is "2.7" do
it "suppresses deprecation warnings for '-W:no-deprecated'" do
ENV["RUBYOPT"] = '-W:no-deprecated'
result = ruby_exe('$; = ""', args: '2>&1')
result.should == ""
end
it "suppresses deprecation warnings for '-W:no-deprecated'" do
ENV["RUBYOPT"] = '-W:no-deprecated'
result = ruby_exe('$; = ""', args: '2>&1')
result.should == ""
end

it "suppresses experimental warnings for '-W:no-experimental'" do
ENV["RUBYOPT"] = '-W:no-experimental'
result = ruby_exe('case 0; in a; end', args: '2>&1')
result.should == ""
end
it "suppresses experimental warnings for '-W:no-experimental'" do
ENV["RUBYOPT"] = '-W:no-experimental'
result = ruby_exe('case 0; in a; end', args: '2>&1')
result.should == ""
end

it "suppresses deprecation and experimental warnings for '-W:no-deprecated -W:no-experimental'" do
ENV["RUBYOPT"] = '-W:no-deprecated -W:no-experimental'
result = ruby_exe('case ($; = ""); in a; end', args: '2>&1')
result.should == ""
end
it "suppresses deprecation and experimental warnings for '-W:no-deprecated -W:no-experimental'" do
ENV["RUBYOPT"] = '-W:no-deprecated -W:no-experimental'
result = ruby_exe('case ($; = ""); in a; end', args: '2>&1')
result.should == ""
end

it "requires the file for '-r'" do
Expand Down
20 changes: 0 additions & 20 deletions core/array/clear_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,10 @@
a.size.should == 0
end

ruby_version_is ''...'2.7' do
it "keeps tainted status" do
a = [1]
a.taint
a.tainted?.should be_true
a.clear
a.tainted?.should be_true
end
end

it "does not accept any arguments" do
-> { [1].clear(true) }.should raise_error(ArgumentError)
end

ruby_version_is ''...'2.7' do
it "keeps untrusted status" do
a = [1]
a.untrust
a.untrusted?.should be_true
a.clear
a.untrusted?.should be_true
end
end

it "raises a FrozenError on a frozen array" do
a = [1]
a.freeze
Expand Down
30 changes: 0 additions & 30 deletions core/array/compact_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@
it "does not return subclass instance for Array subclasses" do
ArraySpecs::MyArray[1, 2, 3, nil].compact.should be_an_instance_of(Array)
end

ruby_version_is ''...'2.7' do
it "does not keep tainted status even if all elements are removed" do
a = [nil, nil]
a.taint
a.compact.tainted?.should be_false
end

it "does not keep untrusted status even if all elements are removed" do
a = [nil, nil]
a.untrust
a.compact.untrusted?.should be_false
end
end
end

describe "Array#compact!" do
Expand All @@ -59,22 +45,6 @@
[1, 2, false, 3].compact!.should == nil
end

ruby_version_is ''...'2.7' do
it "keeps tainted status even if all elements are removed" do
a = [nil, nil]
a.taint
a.compact!
a.tainted?.should be_true
end

it "keeps untrusted status even if all elements are removed" do
a = [nil, nil]
a.untrust
a.compact!
a.untrusted?.should be_true
end
end

it "raises a FrozenError on a frozen array" do
-> { ArraySpecs.frozen_array.compact! }.should raise_error(FrozenError)
end
Expand Down
58 changes: 0 additions & 58 deletions core/array/concat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,64 +41,6 @@
-> { ArraySpecs.frozen_array.concat([]) }.should raise_error(FrozenError)
end

ruby_version_is ''...'2.7' do
it "keeps tainted status" do
ary = [1, 2]
ary.taint
ary.concat([3])
ary.tainted?.should be_true
ary.concat([])
ary.tainted?.should be_true
end

it "is not infected by the other" do
ary = [1,2]
other = [3]; other.taint
ary.tainted?.should be_false
ary.concat(other)
ary.tainted?.should be_false
end

it "keeps the tainted status of elements" do
ary = [ Object.new, Object.new, Object.new ]
ary.each {|x| x.taint }

ary.concat([ Object.new ])
ary[0].tainted?.should be_true
ary[1].tainted?.should be_true
ary[2].tainted?.should be_true
ary[3].tainted?.should be_false
end

it "keeps untrusted status" do
ary = [1, 2]
ary.untrust
ary.concat([3])
ary.untrusted?.should be_true
ary.concat([])
ary.untrusted?.should be_true
end

it "is not infected untrustedness by the other" do
ary = [1,2]
other = [3]; other.untrust
ary.untrusted?.should be_false
ary.concat(other)
ary.untrusted?.should be_false
end

it "keeps the untrusted status of elements" do
ary = [ Object.new, Object.new, Object.new ]
ary.each {|x| x.untrust }

ary.concat([ Object.new ])
ary[0].untrusted?.should be_true
ary[1].untrusted?.should be_true
ary[2].untrusted?.should be_true
ary[3].untrusted?.should be_false
end
end

it "appends elements to an Array with enough capacity that has been shifted" do
ary = [1, 2, 3, 4, 5]
2.times { ary.shift }
Expand Down
10 changes: 4 additions & 6 deletions core/array/deconstruct_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
require_relative '../../spec_helper'

ruby_version_is "2.7" do
describe "Array#deconstruct" do
it "returns self" do
array = [1]
describe "Array#deconstruct" do
it "returns self" do
array = [1]

array.deconstruct.should equal array
end
array.deconstruct.should equal array
end
end
22 changes: 0 additions & 22 deletions core/array/delete_at_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,4 @@
it "raises a FrozenError on a frozen array" do
-> { [1,2,3].freeze.delete_at(0) }.should raise_error(FrozenError)
end

ruby_version_is ''...'2.7' do
it "keeps tainted status" do
ary = [1, 2]
ary.taint
ary.tainted?.should be_true
ary.delete_at(0)
ary.tainted?.should be_true
ary.delete_at(0) # now empty
ary.tainted?.should be_true
end

it "keeps untrusted status" do
ary = [1, 2]
ary.untrust
ary.untrusted?.should be_true
ary.delete_at(0)
ary.untrusted?.should be_true
ary.delete_at(0) # now empty
ary.untrusted?.should be_true
end
end
end
16 changes: 0 additions & 16 deletions core/array/delete_if_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@
-> { ArraySpecs.empty_frozen_array.delete_if {} }.should raise_error(FrozenError)
end

ruby_version_is ''...'2.7' do
it "keeps tainted status" do
@a.taint
@a.tainted?.should be_true
@a.delete_if{ true }
@a.tainted?.should be_true
end

it "keeps untrusted status" do
@a.untrust
@a.untrusted?.should be_true
@a.delete_if{ true }
@a.untrusted?.should be_true
end
end

it_behaves_like :enumeratorized_with_origin_size, :delete_if, [1,2,3]
it_behaves_like :delete_if, :delete_if
end
22 changes: 0 additions & 22 deletions core/array/delete_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,4 @@ def x.==(other) 3 == other end
it "raises a FrozenError on a frozen array" do
-> { [1, 2, 3].freeze.delete(1) }.should raise_error(FrozenError)
end

ruby_version_is ''...'2.7' do
it "keeps tainted status" do
a = [1, 2]
a.taint
a.tainted?.should be_true
a.delete(2)
a.tainted?.should be_true
a.delete(1) # now empty
a.tainted?.should be_true
end

it "keeps untrusted status" do
a = [1, 2]
a.untrust
a.untrusted?.should be_true
a.delete(2)
a.untrusted?.should be_true
a.delete(1) # now empty
a.untrusted?.should be_true
end
end
end
Loading

0 comments on commit 055d83c

Please sign in to comment.