API Docs for: 0.1.0

Class gabarito.Gabarito

Class defined in: lib/gabarito.js:1449
gabarito.Gabarito( )
lib/gabarito.js:1449

Index

Methods

add( test )
lib/gabarito.js:1801

Adds a test within the gabarito.

The test is an object containing various methods. Each method is treated as a test clause. Every draft is run to check if it works.

Parameters:
  • test <Object>

    The test itself

gabarito.Matcher matcher( fn )
lib/gabarito.js:1942

Creates a custom matcher using the function as a matching criteria.

The function will receive a value to examinate and should return a boolean indicating whether the criteria is met.

Parameters:
  • fn <Function>

    The matcher function


Returns: <gabarito.Matcher>
gabarito.VarargsMatcher matcher.args( fn, [msg] )
lib/gabarito.js:1009

Matcher for varargs

Parameters:
  • fn <Function>
  • [msg] <String>

    The optional message format


gabarito.ArgsGrabberMatcher matcher.argsGrabber( )
lib/gabarito.js:1083

Just like the grabber matcher, this matcher that always passes. It stores the values passed to the matcher for further inspection later on.

It works as a varargs matcher.


gabarito.GrabberMatcher matcher.grabber( )
lib/gabarito.js:1056

Returns a matcher that always passes. This matcher stores the value passed to the matcher for further inspection later on.


matcher.type( type, [msg] )
lib/gabarito.js:982

Matcher for a given type

Parameters:
  • type <Function>
  • [msg] <String>

    The optional message format


Returns:

gabarito.Matcher

gabarito.Matcher matcher.value( v, [msg] )
lib/gabarito.js:1023

Literal value matcher

If given value is an object (not a function) or an array, it uses parts.equals, otherwise it will check for it's identity

Parameters:
  • v <Mixed>
  • [msg] <String>

Returns: <gabarito.Matcher>
message( args )
lib/gabarito.js:1907

Tells gabarito to send a message. Messages wont be shown on the console output, they are useful for sending specific messages to the reporters.

Parameters:
  • args <Mixed> (*..n)
on( event, listener )
lib/gabarito.js:1817

Register an event listener for a given event.

Available events:

  • init: The initialization of the gabarito verification.
  • begin: The beginning of a test verification.
  • enter: When gabarito is about to enter into a clause verification.
  • pass: Whenever a clause passes.
  • fail: Whenever a clause fails.
  • end: When a test verification has ended.
  • complete: When all the test verifications have completed.
  • say: Custom event to emit whatever message.
Parameters:
  • event <String>
  • listener <Function>
reset( )
lib/gabarito.js:1766

Resets the gabarito to it's initial state, removing all listeners as well.

say( args )
lib/gabarito.js:1895

Tells gabarito to say something.

Parameters:
  • args <Mixed> (*..n)
Function spy( fn )
lib/gabarito.js:1930

Creates an instance of gabarito.Spy

Parameters:
  • fn <Function>

    Function to spy on


Returns: <Function>

The spy handler function

gabarito.TestBuilder test( [name] )
lib/gabarito.js:1744

Adds a test using the gabarito.TestBuilder within gabarito.

Parameters:
  • [name] <String>

    The test's name


verify( [done] )
lib/gabarito.js:1866

Verify all tests

Parameters:
  • [done] <Function>

Properties

assert <gabarito.Assert>
lib/gabarito.js:1921

Reference containing the various assert utils.

matcher.ANY <gabarito.Matcher>
lib/gabarito.js:964

Always matches

matcher.ANY_ARGS <gabarito.VarargsMatcher>
lib/gabarito.js:973

Always matches any varargs

matcher.ARRAY <gabarito.Matcher>
lib/gabarito.js:924

Matcher for array type

matcher.FUNCTION <gabarito.Matcher>
lib/gabarito.js:934

Matcher for function type

matcher.NUMBER <gabarito.Matcher>
lib/gabarito.js:954

Matcher for array type

matcher.OBJECT <gabarito.Matcher>
lib/gabarito.js:944

Matcher for object type

matcher.STRING <gabarito.Matcher>
lib/gabarito.js:914

Matcher for string type