Class: TestSpecInTestCase

Inherits:
MetaMetaMetaTestCase show all
Includes:
Minitest::Spec::DSL::InstanceMethods
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb

Constant Summary

Constants inherited from Minitest::Test

Minitest::Test::PASSTHROUGH_EXCEPTIONS, Minitest::Test::SETUP_METHODS, Minitest::Test::TEARDOWN_METHODS

Constants included from Minitest::Assertions

Minitest::Assertions::E, Minitest::Assertions::UNDEFINED

Constants inherited from Minitest::Runnable

Minitest::Runnable::SIGNALS

Instance Attribute Summary

Attributes inherited from MetaMetaMetaTestCase

#output, #reporter, #tu

Attributes inherited from Minitest::Runnable

#assertions, #failures, #time

Instance Method Summary collapse

Methods included from Minitest::Spec::DSL::InstanceMethods

#_, #before_setup

Methods inherited from MetaMetaMetaTestCase

#assert_report, #first_reporter, #normalize_output, #restore_env, #run_tu_with_fresh_reporter, #with_stderr

Methods inherited from Minitest::Test

#capture_exceptions, #class_name, #clean, i_suck_and_my_tests_are_order_dependent!, make_my_diffs_pretty!, #neuter_exception, #new_exception, parallelize_me!, #run, runnable_methods, #sanitize_exception, test_order, #with_empty_backtrace_filter, #with_info_handler

Methods included from Minitest::Guard

#jruby?, #maglev?, #mri?, #osx?, #rubinius?, #windows?

Methods included from Minitest::Test::LifecycleHooks

#after_setup, #after_teardown, #before_setup, #before_teardown

Methods included from Minitest::Reportable

#class_name, #error?, #location, #passed?, #result_code, #skipped?

Methods included from Minitest::Assertions

#_synchronize, #assert, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_mock, #assert_nil, #assert_operator, #assert_output, #assert_path_exists, #assert_predicate, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_silent, #assert_throws, #capture_io, #capture_subprocess_io, #diff, diff, diff=, #exception_details, #fail_after, #flunk, #message, #mu_pp, #mu_pp_for_diff, #pass, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_path_exists, #refute_predicate, #refute_respond_to, #refute_same, #skip, #skip_until, #skipped?, #things_to_diff

Methods inherited from Minitest::Runnable

#failure, inherited, #initialize, #marshal_dump, #marshal_load, methods_matching, #name, #name=, on_signal, #passed?, reset, #result_code, run, #run, run_one_method, runnable_methods, runnables, #skipped?, #time_it, #whatever, with_info_handler

Constructor Details

This class inherits a constructor from Minitest::Runnable

Instance Method Details

#assert_triggered(expected, klass = Minitest::Assertion) ⇒ Object



1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1012

def assert_triggered expected, klass = Minitest::Assertion
  @assertion_count += 1

  e = assert_raises klass do
    yield
  end

  msg = e.message.sub(/(---Backtrace---).*/m, "\1")
  msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")

  assert_equal expected, msg
end

#setupObject



1004
1005
1006
1007
1008
1009
1010
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1004

def setup
  super

  Thread.current[:current_spec] = self
  @tc = self
  @assertion_count = 2
end

#teardownObject



1025
1026
1027
1028
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1025

def teardown
  msg = "expected #{@assertion_count} assertions, not #{@tc.assertions}"
  assert_equal @assertion_count, @tc.assertions, msg
end

#test_expectationObject



1030
1031
1032
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1030

def test_expectation
  @tc.assert_equal true, _(1).must_equal(1)
end

#test_expectation_triggeredObject



1034
1035
1036
1037
1038
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1034

def test_expectation_triggered
  assert_triggered "Expected: 2\n  Actual: 1" do
    _(1).must_equal 2
  end
end

#test_expectation_with_a_messageObject



1042
1043
1044
1045
1046
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_spec.rb', line 1042

def test_expectation_with_a_message
  assert_triggered "woot.\nExpected: 2\n  Actual: 1" do
    _(1).must_equal 2, "woot"
  end
end