This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-20
lines changed Expand file tree Collapse file tree 3 files changed +7
-20
lines changed Original file line number Diff line number Diff line change 1
1
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
3
3
require 'minitest'
4
4
require 'minitest/assertions'
5
5
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
7
7
require 'minitest/unit'
8
8
Minitest = MiniTest
9
9
end
Original file line number Diff line number Diff line change 15
15
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
16
RSpec . configure do |config |
17
17
# 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
19
19
# assertions if you prefer.
20
20
config . expect_with :rspec do |expectations |
21
21
# This option will default to `true` in RSpec 4. It makes the `description`
Original file line number Diff line number Diff line change @@ -6,24 +6,11 @@ module Core
6
6
module TestUnitAssertionsAdapter
7
7
include ::Test ::Unit ::Assertions
8
8
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
9
# 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
27
14
end
28
15
end
29
16
end
You can’t perform that action at this time.
0 commit comments