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

Commit 7015305

Browse files
committed
Remove MiniTest workaround
1 parent 304c30f commit 7015305

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-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/project_initializer/spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
1616
RSpec.configure do |config|
1717
# rspec-expectations config goes here. You can use an alternate
18-
# assertion/expectation library such as wrong or the stdlib/minitest
18+
# assertion/expectation library such as wrong or minitest
1919
# assertions if you prefer.
2020
config.expect_with :rspec do |expectations|
2121
# This option will default to `true` in RSpec 4. It makes the `description`

lib/rspec/core/test_unit_assertions_adapter.rb

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,11 @@ 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-
#
159
# 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.
10+
# adding a shim, older versions automatically included their assertion module.
11+
if defined?(::Minitest::Assertions) && ancestors.include?(::Minitest::Assertions)
12+
require 'rspec/core/minitest_assertions_adapter'
13+
include ::RSpec::Core::MinitestAssertionsAdapter
2714
end
2815
end
2916
end

0 commit comments

Comments
 (0)