Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Minitest v5.20 #60

Merged
merged 4 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
ruby: [ '3.0', '3.1', '3.2' ]
gemfile: [ '514', '515', '516', '517', '518' ]
gemfile: [ '514', '515', '516', '517', '518', '519', '520' ]

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Next
- support minitest 5.20

# v5.3.1
- remove MiniTest usage to make Zeitwerk happy
Expand Down
22 changes: 14 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -13,11 +13,16 @@ GEM
reline (>= 0.3.1)
diff-lcs (1.5.0)
io-console (0.6.0)
irb (1.7.0)
reline (>= 0.3.0)
minitest (5.18.1)
irb (1.8.3)
rdoc
reline (>= 0.3.8)
minitest (5.20.0)
psych (5.1.1.1)
stringio
rake (13.0.6)
reline (0.3.5)
rdoc (6.5.0)
psych (>= 4.0.0)
reline (0.3.9)
io-console (~> 0.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -28,10 +33,11 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)
stringio (3.0.8)

PLATFORMS
ruby
Expand All @@ -44,4 +50,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.6
2.4.21
12 changes: 5 additions & 7 deletions gemfiles/514.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -19,15 +19,13 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)

PLATFORMS
arm64-darwin
arm64-darwin-22
x86_64-linux
ruby

DEPENDENCIES
maxitest!
Expand All @@ -36,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
12 changes: 5 additions & 7 deletions gemfiles/515.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -19,15 +19,13 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)

PLATFORMS
arm64-darwin
arm64-darwin-22
x86_64-linux
ruby

DEPENDENCIES
maxitest!
Expand All @@ -36,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
12 changes: 5 additions & 7 deletions gemfiles/516.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -19,15 +19,13 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)

PLATFORMS
arm64-darwin
arm64-darwin-22
x86_64-linux
ruby

DEPENDENCIES
maxitest!
Expand All @@ -36,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
12 changes: 5 additions & 7 deletions gemfiles/517.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -19,15 +19,13 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)

PLATFORMS
arm64-darwin
arm64-darwin-22
x86_64-linux
ruby

DEPENDENCIES
maxitest!
Expand All @@ -36,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
14 changes: 6 additions & 8 deletions gemfiles/518.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.0)
minitest (5.18.0)
minitest (5.18.1)
rake (13.0.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -19,15 +19,13 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rspec-support (3.12.1)

PLATFORMS
arm64-darwin
arm64-darwin-22
x86_64-linux
ruby

DEPENDENCIES
maxitest!
Expand All @@ -36,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
6 changes: 3 additions & 3 deletions gemfiles/519.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.20.0)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
Expand All @@ -25,7 +25,7 @@ GEM
rspec-support (3.12.1)

PLATFORMS
arm64-darwin-22
ruby

DEPENDENCIES
maxitest!
Expand All @@ -34,4 +34,4 @@ DEPENDENCIES
rspec

BUNDLED WITH
2.4.12
2.4.21
3 changes: 3 additions & 0 deletions gemfiles/520.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"
gemspec :path=>"../"
gem "minitest", "~> 5.20.0"
37 changes: 37 additions & 0 deletions gemfiles/520.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PATH
remote: ..
specs:
maxitest (5.3.1)
minitest (>= 5.14.0, < 5.21.0)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.5.0)
minitest (5.20.0)
rake (13.0.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)

PLATFORMS
ruby

DEPENDENCIES
maxitest!
minitest (~> 5.20.0)
rake
rspec

BUNDLED WITH
2.4.21
2 changes: 1 addition & 1 deletion maxitest.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new "maxitest", Maxitest::VERSION do |s|
s.license = "MIT"
s.executables = ["mtest"]

s.add_runtime_dependency "minitest", [">= 5.14.0", "< 5.20.0"]
s.add_runtime_dependency "minitest", [">= 5.14.0", "< 5.21.0"]
s.required_ruby_version = '>= 3', '< 4' # mirroring minitest

s.add_development_dependency "rake"
Expand Down
36 changes: 12 additions & 24 deletions spec/maxitest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@
describe "global_must" do
let(:deprecated) { "DEPRECATED" }

if Gem::Version.new(Minitest::VERSION) >= Gem::Version.new("5.12.0")
it "complain when not used" do
run_cmd("ruby spec/cases/plain.rb").should include deprecated
end
it "complain when not used" do
run_cmd("ruby spec/cases/plain.rb").should include deprecated
end

it "does not complain when used" do
Expand All @@ -181,22 +179,16 @@
end

describe "extra threads" do
if Minitest::VERSION.start_with?("5.0")
it "complains" do
run_cmd("ruby spec/cases/threads.rb -v", fail: true).should include "Upgrade above minitest 5.0"
end
else
it "fails on extra and passes on regular" do
result = with_global_must do
run_cmd("ruby spec/cases/threads.rb -v", fail: true)
end
result.gsub(/\d\.\d+/, "0.0").should include <<-OUT.gsub(/^\s+/, "")
threads#test_0001_is fine without extra threads = 0.0 s = .
threads#test_0002_fails on extra threads = 0.0 s = F
threads#test_0003_can kill extra threads = 0.0 s = .
threads#test_0004_can wait for extra threads = 0.0 s = .
OUT
it "fails on extra and passes on regular" do
result = with_global_must do
run_cmd("ruby spec/cases/threads.rb -v", fail: true)
end
result.gsub(/\d\.\d+/, "0.0").should include <<-OUT.gsub(/^\s+/, "")
threads#test_0001_is fine without extra threads = 0.0 s = .
threads#test_0002_fails on extra threads = 0.0 s = F
threads#test_0003_can kill extra threads = 0.0 s = .
threads#test_0004_can wait for extra threads = 0.0 s = .
OUT
end
end

Expand Down Expand Up @@ -317,11 +309,7 @@ def simulate_tty(&block)
end

def with_global_must(&block)
if Gem::Version.new(Minitest::VERSION) >= Gem::Version.new("5.12.0")
with_env GLOBAL_MUST: 'true', &block
else
yield
end
with_env GLOBAL_MUST: 'true', &block
end

def with_env(h)
Expand Down