Commit 4e3a6af1 4e3a6af173fa86775684350fdfe5095bbc052376 by Mickaël Andrieu

Refactoring of method and correct the output

1 parent 3f97d3d1
......@@ -849,13 +849,15 @@ Tester.prototype.assertType = function assertType(subject, type, message) {
*/
Tester.prototype.assertInstanceOf = function assertInstanceOf(subject, constructor, message) {
"use strict";
var actual = subject instanceof constructor;
return this.assert(utils.equals(actual, true), message, {
if (utils.betterTypeOf(constructor) !== "function") {
throw new CasperError('Invalid constructor.');
}
return this.assert(subject instanceof constructor, message, {
type: "assertInstanceOf",
standard: f('Subject is an instance of: "%s"', constructor),
standard: f('Subject is an instance of: "%s"', constructor.name),
values: {
subject: subject,
constructor: constructor,
constructor: constructor.name,
actual: actual
}
});
......