Open JuanVqz opened 8 months ago
Here is some more information that I found for Minitest version 4.7.3.
The below console results show how we can determine that the after_tests
method exists.
irb(main):031:0> Minitest::Unit.respond_to?(:after_tests)
=> true
irb(main):032:0> defined?(Minitest::Unit)
=> "constant"
If after_run
fails but the above results show that after_tests
is available, then we can use after_tests
to add the required hook.
The workaround we used to solve this:
# config/initializers/minitest.rb
module Minitest
def self.after_run(&block)
Minitest::Unit.after_tests(&block)
end
end
@JuanVqz @fbuys Thanks for sharing all this!
When you have a moment, could you please submit a PR that adds this monkeypatch for applications that are using Minitest < 5.0?
After more investigation it turns out that a simple monkey patch is not enough to get next_rails
to work with minitest 4.7
I believe we need to investigate how to hook into the test suites for minitest 4.7
.
The Minitest extension we currently use for the deprecation tracker is also not compatible with this version of minitest.
Expected Behavior
Be able to use the Minitest deprecation tracker with Ruby 2.3.8 and Rails 3.2.22.5 using the Minitest gem at version 4.7.5
Actual Behavior
If I run the deprecation tracker it breaks with the following error:
Possible Fix
Add a check in the next_rails gem if the app is using Minitest v4, then instead of using
after_run
it should use the correct method (I think it wasafter_tests
).To Reproduce
Additional Information
I researched a little bit it seems like the Minitest gem at version 4.7.3 doesn't have the
after_run
method, it was initially introduced at version 5.0.0If there are more questions feel free to ping me, :+1:
I will abide by the code of conduct