Skip to content

Commit

Permalink
Fail fast if test-unit/minitest integration fails
Browse files Browse the repository at this point in the history
If someone is explicitly requiring "mocha/test_unit" or "mocha/minitest"
then the implication is that they know which test framework they are
trying to integrate with. If the Mocha integration fails (because the
test framework hasn't been loaded) then we should raise an error.

Closes #229.
  • Loading branch information
floehopper committed Oct 15, 2022
1 parent ca69dc9 commit f8215a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions lib/mocha/minitest.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'mocha/ruby_version'
require 'mocha/integration/mini_test'
require 'mocha/deprecation'

unless Mocha::Integration::MiniTest.activate
Mocha::Deprecation.warning(
"MiniTest must be loaded *before* `require 'mocha/minitest'`."
)
raise "MiniTest must be loaded *before* `require 'mocha/minitest'`."
end
5 changes: 1 addition & 4 deletions lib/mocha/test_unit.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
require 'mocha/ruby_version'
require 'mocha/integration/test_unit'
require 'mocha/deprecation'

unless Mocha::Integration::TestUnit.activate
Mocha::Deprecation.warning(
"Test::Unit must be loaded *before* `require 'mocha/test_unit'`."
)
raise "Test::Unit must be loaded *before* `require 'mocha/test_unit'`."
end

0 comments on commit f8215a1

Please sign in to comment.