class Object

Constants

Klass
Minitest

Public Instance Methods

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 rspec-expectations/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
# File rspec-support/benchmarks/class_exec_vs_klass_exec.rb, line 10
def class_exec_args
  Klass.class_exec(:a, :b) { }
end
# File rspec-support/benchmarks/class_exec_vs_klass_exec.rb, line 18
def class_exec_kw_args
  Klass.class_exec(a: :b) { |a:| }
end
# File rspec-support/benchmarks/caller_vs_caller_locations_vs_raise.rb, line 18
def create_stack_trace(n, &block)
  return create_stack_trace(n - 1, &block) if n > 0
  yield
end

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 rspec-expectations/lib/rspec/expectations/minitest_integration.rb, line 10
def expect(*a, &b)
  self.assertions += 1
  super
end
# File rspec-support/benchmarks/class_exec_vs_klass_exec.rb, line 14
def klass_exec_args
  RSpec::Support::WithKeywordsWhenNeeded.class_exec(Klass, :a, :b) { }
end
# File rspec-support/benchmarks/class_exec_vs_klass_exec.rb, line 22
def klass_exec_kw_args
  RSpec::Support::WithKeywordsWhenNeeded.class_exec(Klass, a: :b) { |a:| }
end
# File rspec-expectations/lib/rspec/expectations/minitest_integration.rb, line 40
def not_to(*args)
  ctx.assertions += 1
  super
end
# File rspec-expectations/lib/rspec/expectations/minitest_integration.rb, line 35
def to(*args)
  ctx.assertions += 1
  super
end
# File rspec-expectations/lib/rspec/expectations/minitest_integration.rb, line 45
def to_not(*args)
  ctx.assertions += 1
  super
end
# File rspec-support/benchmarks/map_hash.rb, line 7
def use_inject(input)
  input.inject({}) do |hash, (k, v)|
    hash[k.to_s] = v.to_s
    hash
  end
end
# File rspec-support/benchmarks/map_hash.rb, line 3
def use_map_and_hash_bracket(input)
  Hash[ input.map { |k, v| [k.to_s, v.to_s] } ]
end
# File rspec-support/benchmarks/caller_vs_caller_locations_vs_raise.rb, line 12
def use_raise_lazily
  raise "nope"
rescue StandardError => exception
  return exception
end
# File rspec-support/benchmarks/caller_vs_caller_locations_vs_raise.rb, line 8
def use_raise_to_capture_caller
  use_raise_lazily.backtrace
end