class Minitest::Test
Subclass Test to create your own tests. Typically you’ll want a Test subclass per implementation class.
Subclass Test to create your own tests. Typically you’ll want a Test subclass per implementation class.
Attributes
untyped
Public Class Methods
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/test.rb, line 31 def self.i_suck_and_my_tests_are_order_dependent! class << self undef_method :run_order if method_defined? :run_order define_method :run_order do :alpha end end end
Call this at the top of your tests when you absolutely positively need to have ordered tests. In doing so, you’re admitting that you suck and your tests are weak.
Call this at the top of your tests when you absolutely positively need to have ordered tests. In doing so, you’re admitting that you suck and your tests are weak.
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/test.rb, line 44 def self.make_my_diffs_pretty! require "pp" define_method :mu_pp, &:pretty_inspect end
Make diffs for this Test use pretty_inspect so that diff in assert_equal can have more details. NOTE: this is much slower than the regular inspect but much more usable for complex objects.
Make diffs for this Test use pretty_inspect so that diff in assert_equal can have more details. NOTE: this is much slower than the regular inspect but much more usable for complex objects.
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/test.rb, line 56 def self.parallelize_me! return unless Minitest.parallel_executor include Minitest::Parallel::Test extend Minitest::Parallel::Test::ClassMethods end
Call this at the top of your tests (inside the Minitest::Test subclass or describe block) when you want to run your tests in parallel. In doing so, you’re admitting that you rule and your tests are awesome.
Call this at the top of your tests (inside the Minitest::Test subclass or describe block) when you want to run your tests in parallel. In doing so, you’re admitting that you rule and your tests are awesome.
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/test.rb, line 67 def self.runnable_methods methods = methods_matching(/^test_/) case self.run_order when :random, :parallel then srand Minitest.seed methods.sort.shuffle when :alpha, :sorted then methods.sort else raise "Unknown_order: %p" % [self.run_order] end end
Returns all instance methods starting with “test_”. Based on #run_order, the methods are either sorted, randomized (default), or run in parallel.
Returns all instance methods starting with “test_”. Based on #test_order, the methods are either sorted, randomized (default), or run in parallel.
Public Instance Methods
() { () → untyped } → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest/test.rbs, line 56
def capture_exceptions: () { () -> untyped } -> untyped
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest/test.rbs, line 8
def class_name: () -> untyped
(untyped e) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest/test.rbs, line 58
def neuter_exception: (untyped e) -> untyped
(untyped klass, untyped msg, untyped bt, ?bool kill) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest/test.rbs, line 59
def new_exception: (untyped klass, untyped msg, untyped bt, ?bool kill) -> untyped
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/test.rb, line 84 def run time_it do capture_exceptions do SETUP_METHODS.each do |hook| self.send hook end self.send self.name end TEARDOWN_METHODS.each do |hook| capture_exceptions do self.send hook end end end Result.from self # per contract end
Runs a single test with setup/teardown hooks.
Runs a single test with setup/teardown hooks.
(untyped e) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/minitest/0/minitest/test.rbs, line 57
def sanitize_exception: (untyped e) -> untyped