class Object

Public Instance Methods

aggregate_failures(*args, &block) click to toggle source

Convert a `MultipleExpectationsNotMetError` to a `Minitest::Assertion` error so it gets counted in minitest's summary stats as a failure rather than an error. It would be nice to make `MultipleExpectationsNotMetError` subclass `Minitest::Assertion`, but Minitest's implementation does not treat subclasses the same, so this is the best we can do.

Calls superclass method RSpec::Matchers#aggregate_failures
# File lib/rspec/expectations/minitest_integration.rb, line 20
def aggregate_failures(*args, &block)
  super
rescue RSpec::Expectations::MultipleExpectationsNotMetError => e
  assertion_failed = Minitest::Assertion.new(e.message)
  assertion_failed.set_backtrace e.backtrace
  raise assertion_failed
end
expect(*a, &b) click to toggle source

This `expect` will only be called if the user is using Minitest < 5.6 or if they are not using Minitest::Spec on 5.6+. Minitest::Spec on 5.6+ defines its own `expect` and will have the assertions incremented via our definitions of `to`/`not_to`/`to_not` below.

Calls superclass method
# File lib/rspec/expectations/minitest_integration.rb, line 10
def expect(*a, &b)
  self.assertions += 1
  super
end
not_to(*args) click to toggle source
# File lib/rspec/expectations/minitest_integration.rb, line 40
def not_to(*args)
  ctx.assertions += 1
  super
end
to(*args) click to toggle source
# File lib/rspec/expectations/minitest_integration.rb, line 35
def to(*args)
  ctx.assertions += 1
  super
end
to_not(*args) click to toggle source
# File lib/rspec/expectations/minitest_integration.rb, line 45
def to_not(*args)
  ctx.assertions += 1
  super
end