rails / 5.0.7 / activesupport / testcase.html /

class ActiveSupport::TestCase

Parent:
Minitest::Test
Included modules:
ActiveSupport::Testing::SetupAndTeardown, ActiveSupport::Testing::Assertions, ActiveSupport::Testing::TimeHelpers, ActiveSupport::Testing::FileFixtures, ActiveRecord::TestFixtures

Constants

Assertion

Public Class Methods

test_order () Show source
# File activesupport/lib/active_support/test_case.rb, line 38
def test_order
  ActiveSupport.test_order ||= :random
end

Returns the order in which test cases are run.

ActiveSupport::TestCase.test_order # => :random

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

test_order= (new_order) Show source
# File activesupport/lib/active_support/test_case.rb, line 28
def test_order=(new_order)
  ActiveSupport.test_order = new_order
end

Sets the order in which test cases are run.

ActiveSupport::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)

Public Instance Methods

assert_nothing_raised (*args) { || ... } Show source
# File activesupport/lib/active_support/test_case.rb, line 77
def assert_nothing_raised(*args)
  if args.present?
    ActiveSupport::Deprecation.warn(
      "Passing arguments to assert_nothing_raised "            "is deprecated and will be removed in Rails 5.1.")
  end
  yield
end

Assertion that the block should not raise an exception.

Passes if evaluated code in the yielded block raises no exception.

assert_nothing_raised do
  perform_service(param: 'no_exception')
end

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.