class ActiveSupport::TestCase

Constants

Assertion

Public Class Methods

test_order() click to toggle source

Returns the order in which test cases are run.

ActiveSupport::TestCase.test_order # => :random

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

# File activesupport/lib/active_support/test_case.rb, line 40
def test_order
  ActiveSupport.test_order ||= :random
end
test_order=(new_order) click to toggle source

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)

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

Private Instance Methods

create_blob(data: "Hello world!", filename: "hello.txt", content_type: "text/plain") click to toggle source
# File activestorage/test/test_helper.rb, line 43
def create_blob(data: "Hello world!", filename: "hello.txt", content_type: "text/plain")
  ActiveStorage::Blob.create_after_upload! io: StringIO.new(data), filename: filename, content_type: content_type
end
create_blob_before_direct_upload(filename: "hello.txt", byte_size:, checksum:, content_type: "text/plain") click to toggle source
# File activestorage/test/test_helper.rb, line 53
def create_blob_before_direct_upload(filename: "hello.txt", byte_size:, checksum:, content_type: "text/plain")
  ActiveStorage::Blob.create_before_direct_upload! filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type
end
create_image_blob(filename: "racecar.jpg", content_type: "image/jpeg") click to toggle source
# File activestorage/test/test_helper.rb, line 47
def create_image_blob(filename: "racecar.jpg", content_type: "image/jpeg")
  ActiveStorage::Blob.create_after_upload! \
    io: file_fixture(filename).open,
    filename: filename, content_type: content_type
end
jruby_skip(message = "") click to toggle source

Skips the current run on JRuby using Minitest::Assertions#skip

# File actionmailer/test/abstract_unit.rb, line 44
        def jruby_skip(message = "")
  skip message if defined?(JRUBY_VERSION)
end
read_image_variant(variant) click to toggle source
# File activestorage/test/test_helper.rb, line 57
def read_image_variant(variant)
  MiniMagick::Image.open variant.service.send(:path_for, variant.key)
end
rubinius_skip(message = "") click to toggle source

Skips the current run on Rubinius using Minitest::Assertions#skip

# File actionmailer/test/abstract_unit.rb, line 40
        def rubinius_skip(message = "")
  skip message if RUBY_ENGINE == "rbx"
end