File: minitest_assertions_adapter.rb

package info (click to toggle)
ruby-rspec 3.13.0c0e0m0s1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,856 kB
  • sloc: ruby: 70,868; sh: 1,423; makefile: 99
file content (31 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
begin
  # Only the minitest 5.x gem includes the minitest.rb and assertions.rb files.
  require 'minitest'
  require 'minitest/assertions'
rescue LoadError
  # We must be using Ruby Core's MiniTest or the Minitest gem 4.x.
  require 'minitest/unit'
  Minitest = MiniTest
end

module RSpec
  module Core
    # @private
    module MinitestAssertionsAdapter
      include ::Minitest::Assertions
      # Need to forcefully include Pending after Minitest::Assertions
      # to make sure our own #skip method beats Minitest's.
      include ::RSpec::Core::Pending

      # Minitest 5.x requires this accessor to be available. See
      # https://github.com/seattlerb/minitest/blob/38f0a5fcbd9c37c3f80a3eaad4ba84d3fc9947a0/lib/minitest/assertions.rb#L8
      #
      # It is not required for other extension libraries, and RSpec does not
      # report or make this information available to formatters.
      attr_writer :assertions
      def assertions
        @assertions ||= 0
      end
    end
  end
end