-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Make better use of Minitest's lifecycle #1109
Conversation
I'm used to RSpec's test run handlers. I didn't realize that |
It should probably be: |
@zenspider Thanks for that! (esp since I don't want to rely on MiniTest = Minitest unless defined?(MiniTest)) |
509e89d
to
45ba45e
Compare
If the app is using Rails 4.0 or below, and is using minitest-rails, then |
@blowmage Thanks for that. |
@blowmage n/m Rails 4.0 still limits minitest to 4.0. But, I guess I should update the guide since newest Rails require minitest 5?
|
require 'minitest/autorun' | ||
# Ensure backward compatibility with Minitest 4 | ||
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref:
- https://github.com/rails/rails/blob/9c8a5abb420ded3dce8c2a3e656948fb6430fb64/guides/bug_report_templates/generic_master.rb#L22-L23
- https://github.com/rails/rails/blob/228e3f01cb7cc5d0b51311c5c0185b878c4853cb/guides/bug_report_templates/generic_gem.rb
- https://github.com/rails/rails/pull/19818/files#diff-db6425760f8a3c5c18e1f5316a2b6c29R8
I confess that I was not that concerned about the |
45ba45e
to
e8e292c
Compare
@joaomdmoura I just rebased... As long as we support Rails 4.0, we need to support Minitest 4.x. See #1109 (comment) |
e8e292c
to
b18671f
Compare
@joaomdmoura This fixes issues with coverage on Rails 4.0.. any objections to merging? |
👍 |
Make better use of Minitest's lifecycle
http://blog.arkency.com/2013/06/are-we-abusing-at-exit/
Extracted from #1069
Changes are basically that we have to use Minitest.after_run because of minitest's dependencies on
at_exit
for when it starts to run its suite.execute!
after_run
basically, this is the meat and potatoes of the change
and