Class: CoreExt::TestCase

Inherits:
Minitest::Test
  • Object
show all
Extended by:
CoreExt::Testing::Declarative
Includes:
CoreExt::Testing::Assertions, CoreExt::Testing::FileFixtures, CoreExt::Testing::SetupAndTeardown, CoreExt::Testing::TaggedLogging, CoreExt::Testing::TimeHelpers
Defined in:
lib/core_ext/test_case.rb

Constant Summary collapse

Assertion =
Minitest::Assertion

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CoreExt::Testing::Declarative

test

Methods included from CoreExt::Testing::FileFixtures

#file_fixture

Methods included from Concern

#append_features, #class_methods, extended, #included

Methods included from CoreExt::Testing::TimeHelpers

#travel, #travel_back, #travel_to

Methods included from CoreExt::Testing::Assertions

#assert_difference, #assert_no_difference, #assert_not

Methods included from CoreExt::Testing::SetupAndTeardown

#after_teardown, #before_setup

Methods included from CoreExt::Testing::TaggedLogging

#before_setup

Class Method Details

.run(reporter, options = {}) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/core_ext/test_case.rb', line 44

def run(reporter, options = {})
  if options[:patterns] && options[:patterns].any? { |p| p =~ /:\d+/ }
    options[:filter] = \
      Testing::CompositeFilter.new(self, options[:filter], options[:patterns])
  end

  super
end

.test_orderObject

Returns the order in which test cases are run.

CoreExt::TestCase.test_order # => :random

Possible values are :random, :parallel, :alpha, :sorted. Defaults to :random.



40
41
42
# File 'lib/core_ext/test_case.rb', line 40

def test_order
  CoreExt.test_order ||= :random
end

.test_order=(new_order) ⇒ Object

Sets the order in which test cases are run.

CoreExt::TestCase.test_order = :random # => :random

Valid values are:

  • :random (to run tests in random order)

  • :parallel (to run tests in parallel)

  • :sorted (to run tests alphabetically by method name)

  • :alpha (equivalent to :sorted)



30
31
32
# File 'lib/core_ext/test_case.rb', line 30

def test_order=(new_order)
  CoreExt.test_order = new_order
end

Instance Method Details

#assert_nothing_raised(*args) ⇒ Object

Reveals the intention that the block should not raise any exception.

assert_nothing_raised do
  ...
end


84
85
86
# File 'lib/core_ext/test_case.rb', line 84

def assert_nothing_raised(*args)
  yield
end