Skip to content

Commit

Permalink
Merge pull request #65 from grosser/grosser/docs2
Browse files Browse the repository at this point in the history
fix short backtrace docs
  • Loading branch information
grosser authored May 29, 2024
2 parents 6390e5d + 79e6886 commit fb2cd38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source "https://rubygems.org"
gemspec

gem "debug"
gem "bump" # does not work on old ruby versions -> not run on travis
gem "bump"
15 changes: 11 additions & 4 deletions spec/maxitest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,23 @@
end

it "shows short backtraces" do
# Ruby 3.2 has a different backtrace it add 2 lines
# between the lib/maxitest/timeout.rb
# and the spec/cases/raise.rb
# In Minitest 5.20.0+ the backtrace is more verbose
out = run_cmd("ruby spec/cases/raise.rb", fail: true)

# Ruby 3.2 has a different backtrace it add 2 lines between the lib/maxitest/timeout.rb
# and the spec/cases/raise.rb
out.gsub!(/\n.*previous definition of Timeout.*/, "")

# unify backtraces between ruby versions
output_in = out.gsub!(/:in .*/, "")

output_in.should include "TypeError: Timeout is not a module"
output_in.should include 'spec/cases/raise.rb:11'

# Minitest 5.21.0+ backtrace is more verbose and the short backtrace feature seems to be gone
# re-test by running spec/cases/raise.rb and only loading minitest/autorun and not maxitest
if Minitest::VERSION <= "5.21.0"
output_in.should_not include 'lib/maxitest'
end
end

it "has helpers" do
Expand Down

0 comments on commit fb2cd38

Please sign in to comment.