new BaseTestSuite() → {rooibos.BaseTestSuite}
- Description:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ base methods to override +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
name |
string | test state |
filePath |
invalid | set the name to the name of your test |
pkgPath |
invalid | |
isValid |
boolean | |
hasSoloTests |
boolean | |
hasIgnoredTests |
boolean | |
isSolo |
boolean | |
isIgnored |
boolean | |
noCatch |
boolean | |
isNodeTest |
boolean | |
nodeName |
invalid | |
lineNumber |
integer | |
groups |
dynamic | |
groupsData |
dynamic | |
stats |
invalid | |
currentAssertLineNumber |
dynamic | |
valid |
boolean | |
hasFailures |
boolean | |
hasSoloGroups |
boolean | |
isFailingFast |
boolean | |
stubs |
invalid | |
mocks |
invalid | |
__stubId |
dynamic | |
__mockId |
dynamic | |
__mockTargetId |
dynamic | |
currentExecutionTime |
integer | |
timedOut |
boolean | |
deferred |
invalid | |
invalidValue |
string | special values |
ignoreValue |
string | special value used in mock arguments |
anyStringMatcher |
dynamic | built in any matchers |
anyBoolMatcher |
dynamic | |
anyNumberMatcher |
dynamic | |
anyAAMatcher |
dynamic | |
anyArrayMatcher |
dynamic | |
anyNodeMatcher |
dynamic | |
allowNonExistingMethodsOnMocks |
boolean | |
isAutoAssertingMocks |
boolean | |
currentResult |
invalid | |
global |
invalid | |
catchCrashes |
boolean | |
throwOnFailedAssertion |
boolean |
Returns:
Methods
(protected) afterEach() → {dynamic}
- Source:
Returns:
- Type
- dynamic
assertAAContainsSubset(array, subset, ignoredFieldsopt, msgopt) → {boolean}
- Description:
Asserts the associative array contains the fields contained in subset; while ignoring the fields in the ignoredFields array
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
roAssociativeArray | associative array to check |
||
subset |
roAssociativeArray | associative array of values to check for |
||
ignoredFields |
roArray |
<optional> |
invalid
|
array of field names to ignore while comparing |
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertAAHasKey(aa, key, msgopt) → {boolean}
- Description:
Fail if the aa doesn't have the key.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aa |
Dynamic | target aa |
||
key |
String | key name |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertAAHasKeys(aa, keys, msgopt) → {boolean}
- Description:
Fail if the aa doesn't have the keys list.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aa |
Dynamic | A target associative array. |
||
keys |
Dynamic | Array of key names. |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertAANotHasKey(aa, key, msgopt) → {boolean}
- Description:
Fail if the aa has the key.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aa |
Dynamic | target aa |
||
key |
String | key name |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertAANotHasKeys(aa, keys, msgopt) → {boolean}
- Description:
Fail if the aa has the keys list.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aa |
Dynamic | A target associative array. |
||
keys |
Dynamic | Array of key names. |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayContains(array, value, keyopt, msgopt) → {boolean}
- Description:
Fail if the array doesn't have the item.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
value |
Dynamic | value to check - value to check for |
||
key |
Dynamic |
<optional> |
invalid
|
key name in associative array |
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayContainsAAs(array, values, msgopt) → {boolean}
- Description:
Fail if the array does not contain all of the aa's in the values array.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
values |
Dynamic | array of aas to look for in target array |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayContainsOnlyValuesOfType(array, typeStr, msgopt) → {boolean}
- Description:
Fail if the array doesn't contains items of specific type only.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
typeStr |
String | type name - must be String, Array, Boolean, or AssociativeArray |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayContainsSubset(array, subset, msgopt) → {boolean}
- Description:
Fail if the array doesn't have the item subset.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
subset |
Dynamic | items to check presence of |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayCount(array, count, msgopt) → {boolean}
- Description:
Fail if the array items count <> expected count
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
count |
Dynamic | An expected array items count |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayNotContains(array, value, keyopt, msgopt) → {boolean}
- Description:
Fail if the array has the item.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
value |
Dynamic | value to check - Value to check for |
||
key |
Dynamic |
<optional> |
invalid
|
A key name for associative array. |
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayNotContainsSubset(array, subset, msgopt) → {boolean}
- Description:
Fail if the array have the item from subset.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
subset |
Dynamic | items to check presence of |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertArrayNotCount(array, count, msgopt) → {boolean}
- Description:
Fail if the array items count = expected count.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
array |
Dynamic | target array |
||
count |
Dynamic | An expected array items count. |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertAsyncField(target, fieldName, delayopt, maxAttemptsopt) → {boolean}
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
dynamic | |||
fieldName |
string | |||
delay |
integer |
<optional> |
500
|
|
maxAttempts |
integer |
<optional> |
10
|
Returns:
- Type
- boolean
assertClass(value, expectedClassName, msgopt) → {boolean}
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
dynamic | |||
expectedClassName |
dynamic | |||
msg |
string |
<optional> |
""
|
Returns:
- Type
- boolean
assertEmpty(item, msgopt) → {boolean}
- Description:
Fail if the item is not empty array or string.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
item |
Dynamic | item to check |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertEqual(first, second, msgopt) → {boolean}
- Description:
Fail if the two objects are unequal as determined by the '<>' operator.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
first |
Dynamic | first object to compare |
||
second |
Dynamic | second object to compare |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertFalse(expr, msgopt) → {boolean}
- Description:
Fail the test if the expression is true.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
expr |
Dynamic | An expression to evaluate. |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertInvalid(value, msgopt) → {boolean}
- Description:
Fail if the value is not invalid.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
Dynamic | value to check - value to check for |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertLike(first, second, msgopt) → {boolean}
- Description:
does a fuzzy comparison
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
first |
Dynamic | first object to compare |
||
second |
Dynamic | second object to compare |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertMocks() → {void}
- Description:
Will check all mocks that have been created to ensure they were invoked the expected amount of times, with the expected args.
- Source:
Returns:
- Type
- void
assertNodeContains(node, value, msgopt) → {boolean}
- Description:
Asserts the node contains the child value
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | a node to check |
||
value |
Dynamic | value to check - value to look for |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeContainsFields(node, subset, ignoredFieldsopt, msgopt) → {boolean}
- Description:
Fail if the node doesn't have the item subset.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | A target node |
||
subset |
Dynamic | items to check |
||
ignoredFields |
dynamic |
<optional> |
invalid
|
|
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeContainsOnly(node, value, msgopt) → {boolean}
- Description:
Asserts the node contains only the child value
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | a node to check |
||
value |
Dynamic | value to check - value to look for |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeCount(node, count, msgopt) → {boolean}
- Description:
Asserts that the node contains the designated number of children
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | target node |
||
count |
Integer | expected number of child items |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert w, false otherwise
- Type
- boolean
assertNodeEmpty(node, msgopt) → {boolean}
- Description:
Asserts the node has no children
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | a node to check |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeNotContains(node, value, msgopt) → {boolean}
- Description:
Fail if the node h item.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | A target node |
||
value |
Dynamic | value to check - a node child |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeNotContainsFields(node, subset, msgopt) → {boolean}
- Description:
Fail if the node have the item from subset.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | A target node |
||
subset |
Dynamic | the items to check for |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert w, false otherwise
- Type
- boolean
assertNodeNotCount(node, count, msgopt) → {boolean}
- Description:
Fail if the node items count = expected count.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | A target node |
||
count |
Integer | Expected item count |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNodeNotEmpty(node, msgopt) → {boolean}
- Description:
Asserts the node has children
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
node |
Dynamic | a node to check |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNotEmpty(item, msgopt) → {boolean}
- Description:
Fail if the item is empty array or string.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
item |
Dynamic | item to check |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNotEqual(first, second, msgopt) → {boolean}
- Description:
Fail if the two objects are equal as determined by the '=' operator.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
first |
Dynamic | first object to compare |
||
second |
Dynamic | second object to compare |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertNotInvalid(value, msgopt) → {boolean}
- Description:
Fail if the value is invalid.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
Dynamic | value to check - value to check for |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertSubType(value, typeStr, msgopt) → {boolean}
- Description:
Asserts that the value is a node of designated subtype
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
Dynamic | value to check - target node |
||
typeStr |
String | type name |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertTrue(expr, msgopt) → {boolean}
- Description:
Fail the test unless the expression is true.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
expr |
Dynamic | An expression to evaluate. |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
assertType(value, typeStr, msgopt) → {boolean}
- Description:
Asserts that the value is a node of designated type
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
Dynamic | value to check - target node |
||
typeStr |
String | type name |
||
msg |
String |
<optional> |
""
|
alternate error message |
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
(protected) beforeEach() → {dynamic}
- Source:
Returns:
- Type
- dynamic
cleanMocks() → {void}
- Description:
Cleans up all tracking data associated with mocks
- Source:
Returns:
- Type
- void
cleanStubs() → {void}
- Description:
Cleans up all tracking data associated with stubs
- Source:
Returns:
- Type
- void
combineFakes(fake, otherFake) → {dynamic}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
fake |
roAssociativeArray | |
otherFake |
roAssociativeArray |
Returns:
- Type
- dynamic
createFake(id, target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt) → {object}
- Description:
Creates a stub to replace a real method with. This is used internally.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
id |
dynamic | |||
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
expectedInvocations |
Dynamic |
<optional> |
1
|
number of invocations we expect |
expectedArgs |
Dynamic |
<optional> |
invalid
|
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
Returns:
stub that was wired into the real method
- Type
- object
done() → {dynamic}
- Source:
Returns:
- Type
- dynamic
expect(target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
- Description:
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
expectedInvocations |
Dynamic |
<optional> |
1
|
number of invocations we expect |
expectedArgs |
Dynamic |
<optional> |
invalid
|
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
mock that was wired into the real method
- Type
- object
expectCalled(invocation, returnValueopt) → {object}
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
invocation |
dynamic | |||
returnValue |
dynamic |
<optional> |
invalid
|
Returns:
- Type
- object
expectLastCallToThrowError(error) → {dynamic}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
error |
dynamic |
Returns:
- Type
- dynamic
expectNone(target, methodName, allowNonExistingMethodsopt) → {object}
- Description:
Creates a stub to replace a real method with, which the framework will track. If it was invoked, it will result in test failure
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
mock that was wired into the real method
- Type
- object
expectNotCalled(invocation) → {object}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
invocation |
dynamic |
Returns:
- Type
- object
expectOnce(target, methodName, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
- Description:
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
expectedArgs |
Dynamic |
<optional> |
invalid
|
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
mock that was wired into the real method
- Type
- object
expectOnceOrNone(target, methodName, isExpected, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {dynamic}
- Description:
Toggles between expectOnce and expectNone, to allow for easy parameterized expect behavior
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
isExpected |
Dynamic | if true, then this is the same as expectOnce, if false, then this is the same as expectNone |
||
expectedArgs |
Dynamic |
<optional> |
invalid
|
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
mock that was wired into the real method
- Type
- dynamic
fail(msgopt, actualopt, expectedopt, createErroropt) → {boolean}
- Description:
Fail immediately, with the given message
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
msg |
String |
<optional> |
"Error"
|
message to display in the test report |
actual |
string |
<optional> |
""
|
|
expected |
string |
<optional> |
""
|
|
createError |
boolean |
<optional> |
false
|
Returns:
true if the assert was satisfied, false otherwise
- Type
- boolean
failBecauseOfTimeOut() → {boolean}
- Source:
Returns:
- Type
- boolean
failCrash(error, msgopt) → {boolean}
- Description:
Fail immediately, with the given exception
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
error |
Dynamic | exception to fail on |
||
msg |
String |
<optional> |
""
|
message to display in the test report |
Returns:
true if failure was set, false if the test is already failed
- Type
- boolean
mock(target, methodName, expectedInvocationsopt, expectedArgsopt, returnValueopt, allowNonExistingMethodsopt) → {object}
- Description:
Creates a stub to replace a real method with, which the framework will track. If it was invoked the wrong number of times, or with wrong arguments, it will result in test failure
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
expectedInvocations |
Dynamic |
<optional> |
1
|
number of invocations we expect |
expectedArgs |
Dynamic |
<optional> |
invalid
|
array containing the arguments we expect the method to be invoked with |
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
mock that was wired into the real method
- Type
- object
mockFail(lineNumber, methodName, message) → {dynamic}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
lineNumber |
integer | |
methodName |
dynamic | |
message |
string |
Returns:
- Type
- dynamic
(protected) setup() → {dynamic}
- Source:
Returns:
- Type
- dynamic
stub(target, methodName, returnValueopt, allowNonExistingMethodsopt) → {roAssociativeArray}
- Description:
Creates a stub to replace a real method with
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
target |
Dynamic | object on which the method to be stubbed is found |
||
methodName |
Dynamic | name of method to stub |
||
returnValue |
Dynamic |
<optional> |
invalid
|
value that the stub method will return when invoked |
allowNonExistingMethods |
Boolean |
<optional> |
false
|
if true, then rooibos will only warn if the method did not exist prior to faking |
Returns:
stub that was wired into the real method
- Type
- roAssociativeArray
stubCall(invocation, stubOrReturnValueopt, functionNameopt) → {roAssociativeArray}
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
invocation |
dynamic | |||
stubOrReturnValue |
dynamic |
<optional> |
invalid
|
|
functionName |
string |
<optional> |
""
|
Returns:
- Type
- roAssociativeArray
(protected) tearDown() → {dynamic}
- Source:
Returns:
- Type
- dynamic
wait(delayopt) → {dynamic}
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
delay |
integer |
<optional> |
1
|
Returns:
- Type
- dynamic
waitForField(field, max, target, fieldName, delayopt, maxAttemptsopt) → {boolean}
- Description:
observeField doesn't work in regular unit tests, so we have to wait for the result. We can use this to wait for a network task, foe example, and pass the result directly to a handler. Note - we wait for the value TO CHANGE - so make sure that will be the case, or you'll get stuck forever :)
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
field |
String | to observe |
||
max |
int | attempts |
||
target |
any | to observe |
||
fieldName |
string | |||
delay |
int |
<optional> |
500
|
for each wait |
maxAttempts |
integer |
<optional> |
10
|
Returns:
- Type
- boolean