如何在 class 之外使用 Minitest 断言?

How to use Minitest assertions outside of a class?

我正在尝试这个:

require 'minitest'
Minitest::Assertions::assert_equal(1, 1)

无效:

NoMethodError: undefined method `assert_equal' for Minitest::Assertions:Module

正确的方法是什么?方法 does exist.

module Assertions
  extend Minitest::Assertions

  class << self
    attr_accessor :assertions
  end

  self.assertions = 0
end

Assertions.assert(true)
Assertions.assert(false)

Minitest::Assertions 模块期望能够增加名为 assertions.

的实例访问器

http://docs.seattlerb.org/minitest/Minitest/Assertions.html