module Sus

Nested Classes and Modules

class Assertions

Represents a collection of test assertions and their results. Tracks passed, failed, skipped, and errored assertions.

class Base

Represents the base test case class. Provides core functionality for test execution including hooks for setup and teardown.

class Be

Represents a predicate matcher that can be used with expect(...).to be(...).

module BeTruthy

Represents a predicate that checks if the subject is truthy.

module BeFalsey

Represents a predicate that checks if the subject is falsey.

class BeWithin

Represents a predicate that checks if the subject is within a tolerance of a value.

class Clock

Represents a clock for measuring elapsed time during test execution.

class Config

Represents the configuration for running tests.

module Context

Represents a test context that can contain nested tests and other contexts.

module Describe

Represents a test group that describes a subject (class, module, or feature).

class Expect

Represents an expectation that can be used with predicates to make assertions.

module File

Represents a test file that can be loaded and executed.

class FileLoadError

Represents an error that occurred while loading a test file.

class Filter

Provides a way to filter the registry according to the suffix on loaded paths.

module Fixtures
module Have

Represents predicates for checking collections and object attributes.

class HaveDuration

Represents a predicate that measures the duration of a block execution.

class Identity

Represents a unique identity for a test or context, used for identification and location tracking.

module Integrations
module It

Represents an individual test case.

module ItBehavesLike

Represents a test context that behaves like a shared context.

class Mock

Represents a mock object that can intercept and replace method calls on a target object.

module Mocks

Provides mock management functionality for test cases.

module Output

Represents output handlers for test results and messages.

class RaiseException

Represents a predicate that checks if a block raises an exception.

class Receive

Represents an expectation that a method will be called on an object.

class Registry

Represents a registry of test files and contexts.

class RespondTo

Represents a predicate that checks if an object responds to a method.

module Shared

Represents a shared test context that can be reused across multiple test files.

class Tree

Represents a tree structure of test contexts.

module With

Represents a test context with specific conditions or variables.

Definitions

def self.base(description = nil, root: nil)

Create a new base test class with the given description.

Signature

parameter description String | Nil

Optional description for the test class.

parameter root String | Nil

Optional root path for the test identity.

returns Class

A new test class that extends class Sus::Base.

Implementation

def self.base(description = nil, root: nil)
	base = Class.new(Base)
	
	base.extend(Context)
	base.identity = Identity.new(root) if root
	base.description = description
	base.set_temporary_name("#{self}[#{description}]")
	
	return base
end

def self.Shared(name, &block)

Create a new shared test context.

Signature

parameter name String

The name of the shared context.

yields {...}

The block containing the shared test code.

returns Shared

A new Shared module.

Implementation

def self.Shared(name, &block)
	Shared.build(name, block)
end