class TestMinitestUnitOrder

Public Instance Methods

test_after_teardown() click to toggle source
Calls superclass method
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 668
def test_after_teardown
  call_order = []
  @tu =
  Class.new FakeNamedTest do
    define_method :teardown do
      super()
      call_order << :teardown
    end

    define_method :after_teardown do
      call_order << :after_teardown
    end

    def test_omg; assert true; end
  end

  run_tu_with_fresh_reporter

  expected = [:teardown, :after_teardown]
  assert_equal expected, call_order
end
test_all_teardowns_are_guaranteed_to_run() click to toggle source
Calls superclass method
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 690
def test_all_teardowns_are_guaranteed_to_run
  call_order = []
  @tu =
  Class.new FakeNamedTest do
    define_method :after_teardown do
      super()
      call_order << :after_teardown
      raise
    end

    define_method :teardown do
      super()
      call_order << :teardown
      raise
    end

    define_method :before_teardown do
      super()
      call_order << :before_teardown
      raise
    end

    def test_omg; assert true; end
  end

  run_tu_with_fresh_reporter

  expected = [:before_teardown, :teardown, :after_teardown]
  assert_equal expected, call_order
end
test_before_setup() click to toggle source

do not parallelize this suite… it just can’t handle it.

Calls superclass method
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 646
def test_before_setup
  call_order = []
  @tu =
  Class.new FakeNamedTest do
    define_method :setup do
      super()
      call_order << :setup
    end

    define_method :before_setup do
      call_order << :before_setup
    end

    def test_omg; assert true; end
  end

  run_tu_with_fresh_reporter

  expected = [:before_setup, :setup]
  assert_equal expected, call_order
end
test_omg() click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 659
def test_omg; assert true; end
test_setup_and_teardown_survive_inheritance() click to toggle source
# File minitest-5.13.0/test/minitest/test_minitest_test.rb, line 721
def test_setup_and_teardown_survive_inheritance
  call_order = []

  @tu = Class.new FakeNamedTest do
    define_method :setup do
      call_order << :setup_method
    end

    define_method :teardown do
      call_order << :teardown_method
    end

    define_method :test_something do
      call_order << :test
    end
  end

  run_tu_with_fresh_reporter

  @tu = Class.new @tu
  run_tu_with_fresh_reporter

  # Once for the parent class, once for the child
  expected = [:setup_method, :test, :teardown_method] * 2

  assert_equal expected, call_order
end