module Sus
Nested Classes and Modules
class AssertionsRepresents a collection of test assertions and their results. Tracks passed, failed, skipped, and errored assertions.
class BaseRepresents the base test case class. Provides core functionality for test execution including hooks for setup and teardown.
class BeRepresents a predicate matcher that can be used with
expect(...).to be(...).module BeTruthyRepresents a predicate that checks if the subject is truthy.
module BeFalseyRepresents a predicate that checks if the subject is falsey.
class BeWithinRepresents a predicate that checks if the subject is within a tolerance of a value.
class ClockRepresents a clock for measuring elapsed time during test execution.
class ConfigRepresents the configuration for running tests.
module ContextRepresents a test context that can contain nested tests and other contexts.
module DescribeRepresents a test group that describes a subject (class, module, or feature).
class ExpectRepresents an expectation that can be used with predicates to make assertions.
module FileRepresents a test file that can be loaded and executed.
class FileLoadErrorRepresents an error that occurred while loading a test file.
class FilterProvides a way to filter the registry according to the suffix on loaded paths.
module HaveRepresents predicates for checking collections and object attributes.
class HaveDurationRepresents a predicate that measures the duration of a block execution.
class IdentityRepresents a unique identity for a test or context, used for identification and location tracking.
module ItRepresents an individual test case.
module ItBehavesLikeRepresents a test context that behaves like a shared context.
class MockRepresents a mock object that can intercept and replace method calls on a target object.
module MocksProvides mock management functionality for test cases.
module OutputRepresents output handlers for test results and messages.
class RaiseExceptionRepresents a predicate that checks if a block raises an exception.
class ReceiveRepresents an expectation that a method will be called on an object.
class RegistryRepresents a registry of test files and contexts.
class RespondToRepresents a predicate that checks if an object responds to a method.
module SharedRepresents a shared test context that can be reused across multiple test files.
class TreeRepresents a tree structure of test contexts.
module WithRepresents 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
descriptionString | Nil Optional description for the test class.
-
parameter
rootString | 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