SubjectFactory

certainty~ SubjectFactory

new SubjectFactory()

Singleton factory that accepts a value to be tested, queries it's type, and constructs an appropriate Subject type to wrap it.

Source:

Methods

addType(typeTest, func)

Register a new type with the factory.

Parameters:
Name Type Description
typeTest function

A function which returns true when the type is recognized.

func FailureStrategy

Constructor function for the subject for this type.

Source:

newSubject(failureStrategy, value) → {Subject}

Create a new Subject instance given a value. The factory will look through the list of registered types to find a subject constructor function, and return the appropriate Subject subclass for that value type.

Parameters:
Name Type Description
failureStrategy FailureStrategy

The failure strategy to use when an assertion fails.

value *

The value being checked.

Source:
Returns:

A subject instance.

Type
Subject