Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
47eff271
...
47eff271d0d8d7747b2bc010533303ada34b3ff3
authored
2012-05-03 11:34:55 +0300
by
Julian Gruber
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added assertNotEquals, the inverse of assertEquals
1 parent
51a03f65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
modules/tester.js
modules/tester.js
View file @
47eff27
...
...
@@ -141,6 +141,41 @@ var Tester = function Tester(casper, options) {
}
});
};
/**
* Asserts that two values are strictly not equals.
*
* @param Mixed subject The value to test
* @param Mixed expected The unwanted value
* @param String message Test description
*/
this
.
assertNotEquals
=
function
assertNotEquals
(
subject
,
shouldnt
,
message
)
{
var
eventName
;
message
=
message
||
""
;
if
(
!
this
.
testEquals
(
subject
,
shouldnt
))
{
eventName
=
"success"
;
casper
.
echo
(
this
.
colorize
(
this
.
options
.
passText
,
'INFO'
)
+
' '
+
this
.
formatMessage
(
message
));
this
.
testResults
.
passed
++
;
}
else
{
eventName
=
"fail"
;
casper
.
echo
(
this
.
colorize
(
this
.
options
.
failText
,
'RED_BAR'
)
+
' '
+
this
.
formatMessage
(
message
,
'WARNING'
));
this
.
comment
(
' got: '
+
utils
.
serialize
(
subject
));
this
.
comment
(
' shouldnt: '
+
utils
.
serialize
(
shouldnt
));
this
.
testResults
.
failed
++
;
}
this
.
emit
(
eventName
,
{
type
:
"assertNotEquals"
,
message
:
message
,
details
:
f
(
"test failed; shouldnt: %s; got: %s"
,
shouldnt
,
subject
),
file
:
this
.
currentTestFile
,
values
:
{
subject
:
subject
,
shouldnt
:
shouldnt
}
});
};
/**
* Asserts that a code evaluation in remote DOM resolves to true.
...
...
Please
register
or
sign in
to post a comment