Skip to content

Commit

Permalink
Use minitest vs mini_test everywhere
Browse files Browse the repository at this point in the history
As noted by @zenspider in this comment [1], the rename is over 10 years
old, so it seems about time we update it!

I've also renamed `test/mini_test_result.rb` ->
`test/minitest_result_pre_v5.rb` to better explain its purpose. I did
initially think about removing this, but we're still running pre v5
versions of Minitest in the CI builds for Ruby v2.0 & v2.1, so I'm going
to leave that for now and address it separately.

[1]: #614 (comment)
  • Loading branch information
floehopper committed Nov 12, 2023
1 parent d214d42 commit 2d64fcd
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .yardopts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lib/mocha/expectation_error.rb
lib/mocha/stubbing_error.rb
lib/mocha/unexpected_invocation.rb
lib/mocha/integration/test_unit/adapter.rb
lib/mocha/integration/mini_test/adapter.rb
lib/mocha/integration/minitest/adapter.rb
-
RELEASE.md
COPYING.md
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace 'test' do # rubocop:disable Metrics/BlockLength
desc 'Run Minitest integration tests (intended to be run in its own process)'
Rake::TestTask.new('minitest') do |t|
t.libs << 'test'
t.test_files = FileList['test/integration/mini_test_test.rb']
t.test_files = FileList['test/integration/minitest_test.rb']
t.verbose = true
t.warning = true
end
Expand Down Expand Up @@ -93,7 +93,7 @@ end
# rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def benchmark_test_case(klass, iterations)
require 'benchmark'
require 'mocha/detection/mini_test'
require 'mocha/detection/minitest'

if defined?(Minitest)
minitest_version = Gem::Version.new(Mocha::Detection::Minitest.version)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'mocha/debug'
require 'mocha/detection/mini_test'
require 'mocha/integration/mini_test/adapter'
require 'mocha/detection/minitest'
require 'mocha/integration/minitest/adapter'

module Mocha
module Integration
Expand All @@ -9,10 +9,10 @@ def self.activate
target = Detection::Minitest.testcase
return false unless target

mini_test_version = Gem::Version.new(Detection::Minitest.version)
Debug.puts "Detected Minitest version: #{mini_test_version}"
minitest_version = Gem::Version.new(Detection::Minitest.version)
Debug.puts "Detected Minitest version: #{minitest_version}"

unless Minitest::Adapter.applicable_to?(mini_test_version)
unless Minitest::Adapter.applicable_to?(minitest_version)
raise 'Versions of minitest earlier than v3.3.0 are not supported.'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module Adapter
include Mocha::API

# @private
def self.applicable_to?(mini_test_version)
Gem::Requirement.new('>= 3.3.0').satisfied_by?(mini_test_version)
def self.applicable_to?(minitest_version)
Gem::Requirement.new('>= 3.3.0').satisfied_by?(minitest_version)
end

# @private
Expand Down
2 changes: 1 addition & 1 deletion lib/mocha/minitest.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'mocha/ruby_version'
require 'mocha/integration/mini_test'
require 'mocha/integration/minitest'

unless Mocha::Integration::Minitest.activate
raise "Minitest must be loaded *before* `require 'mocha/minitest'`."
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), 'unit', 'parameter_matchers'))
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), 'acceptance'))

require 'mocha/detection/mini_test'
require 'mocha/detection/minitest'

begin
require 'minitest'
Expand Down
4 changes: 2 additions & 2 deletions test/test_runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'assertions'

require 'mocha/detection/mini_test'
require 'mocha/detection/minitest'

module TestRunner
def run_as_test(&block)
Expand Down Expand Up @@ -28,7 +28,7 @@ def run_as_tests(methods = {})
Minitest::Runnable.runnables.delete(test_class)
test_result = MinitestResult.new(tests)
elsif Gem::Requirement.new('> 0.0.0', '< 5.0.0').satisfied_by?(minitest_version)
require File.expand_path('../mini_test_result', __FILE__)
require File.expand_path('../minitest_result_pre_v5', __FILE__)
runner = Minitest::Unit.new
tests.each do |test|
test.run(runner)
Expand Down

0 comments on commit 2d64fcd

Please sign in to comment.