Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit ba23a61

Browse files
committed
Remove MiniTest workaround
1 parent 08629b2 commit ba23a61

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

lib/rspec/core/minitest_assertions_adapter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
begin
2-
# Only the minitest 5.x gem includes the minitest.rb and assertions.rb files.
2+
# Only Minitest 5.x includes minitest.rb and assertions.rb files
33
require 'minitest'
44
require 'minitest/assertions'
55
rescue LoadError
6-
# We must be using Ruby Core's MiniTest or the Minitest gem 4.x.
6+
# We must be using Minitest 4.x
77
require 'minitest/unit'
88
Minitest = MiniTest
99
end

lib/rspec/core/test_unit_assertions_adapter.rb

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,9 @@ module Core
66
module TestUnitAssertionsAdapter
77
include ::Test::Unit::Assertions
88

9-
# If using test/unit from Ruby core with Ruby 1.9+, it includes
10-
# MiniTest::Assertions by default. Note the upcasing of 'Test'.
11-
#
12-
# If the test/unit gem is being loaded, it will not include any minitest
13-
# assertions.
14-
#
15-
# Only if Minitest 5.x is included / loaded do we need to worry about
16-
# adding a shim for the new updates. Thus instead of checking on the
17-
# RUBY_VERSION we need to check ancestors.
18-
begin
19-
# MiniTest is 4.x.
20-
# Minitest is 5.x.
21-
if ancestors.include?(::Minitest::Assertions)
22-
require 'rspec/core/minitest_assertions_adapter'
23-
include ::RSpec::Core::MinitestAssertionsAdapter
24-
end
25-
rescue NameError
26-
# No-op. Minitest 5.x was not loaded.
9+
if defined?(::Minitest::Assertions) && ancestors.include?(::Minitest::Assertions)
10+
require 'rspec/core/minitest_assertions_adapter'
11+
include ::RSpec::Core::MinitestAssertionsAdapter
2712
end
2813
end
2914
end

0 commit comments

Comments
 (0)