Skip to content

Commit aa7957e

Browse files
committed
Don't mess with Minitest unless RAILS_ENV is set
Minitest will automatically scan all installed gems and load plugins from those gems. We should detect whether or not we're being run within the context of a Rails app and only change MT behavior in that case. To determine if we're being run via `bin/rails` we'll just check if RAILS_ENV is set. Ref: minitest/minitest#996 Ref: minitest/minitest#725
1 parent 793ff00 commit aa7957e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

railties/lib/minitest/rails_plugin.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ def self.plugin_rails_options(opts, options)
109109
# Owes great inspiration to test runner trailblazers like RSpec,
110110
# minitest-reporters, maxitest, and others.
111111
def self.plugin_rails_init(options)
112+
# Don't mess with Minitest unless RAILS_ENV is set
113+
return unless ENV["RAILS_ENV"]
114+
112115
unless options[:full_backtrace]
113116
# Plugin can run without Rails loaded, check before filtering.
114117
if ::Rails.respond_to?(:backtrace_cleaner)

0 commit comments

Comments
 (0)