abstract class Spectator::Node

Overview

A single item in a test spec. This is commonly an Example or ExampleGroup, but can be anything that should be iterated over when running the spec.

Direct Known Subclasses

Defined in:

spectator/node.cr

Constant Summary

DEFAULT_PENDING_REASON = "No reason given"

Default text used if none was given by the user for skipping a node.

Constructors

Instance Method Summary

Instance methods inherited from class Object

should(matcher, message = nil) should, should_eventually(matcher, message = nil) should_eventually, should_never(matcher, message = nil) should_never, should_not(matcher, message = nil) should_not

Constructor Detail

def self.new(name : Label = nil, location : Location? = nil, metadata : Metadata = Metadata.new) #

Creates the node. The name describes the purpose of the node. It can be a Symbol to describe a type. The location tracks where the node exists in source code. A set of metadata can be used for filtering and modifying example behavior.


[View source]

Instance Method Detail

def display_name #

Non-nil name used to show the node name.


[View source]
abstract def finished? : Bool #

Indicates whether the node has completed.


[View source]
def inspect(io) #

Exposes information about the node useful for debugging.


[View source]
def location : Location #

Location of the node in source code.


[View source]
def location? : Location? #

Location of the node in source code.


[View source]
def metadata : Metadata #

User-defined tags and values used for filtering and behavior modification.


[View source]
def name : Label #

User-provided name or description of the node. This does not include the group name or descriptions. Use #to_s to get the full name.

This value will be nil if no name was provided. In this case, and the node is a runnable example, the name should be set to the description of the first matcher that runs in the test case.

If this value is a Symbol, the user specified a type for the name.


[View source]
def name? : Label? #

User-provided name or description of the node. This does not include the group name or descriptions. Use #to_s to get the full name.

This value will be nil if no name was provided. In this case, and the node is a runnable example, the name should be set to the description of the first matcher that runs in the test case.

If this value is a Symbol, the user specified a type for the name.


[View source]
def pending? #

Checks if the node has been marked as pending. Pending items should be skipped during execution.


[View source]
def pending_reason #

Gets the reason the node has been marked as pending.


[View source]
def tags #

Retrieves just the tag names applied to the node.


[View source]
def to_s(io) #

Constructs the full name or description of the node. This prepends names of groups this node is part of.


[View source]