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) { ...@@ -849,13 +849,15 @@ Tester.prototype.assertType = function assertType(subject, type, message) {
849 */ 849 */
850 Tester.prototype.assertInstanceOf = function assertInstanceOf(subject, constructor, message) { 850 Tester.prototype.assertInstanceOf = function assertInstanceOf(subject, constructor, message) {
851 "use strict"; 851 "use strict";
852 var actual = subject instanceof constructor; 852 if (utils.betterTypeOf(constructor) !== "function") {
853 return this.assert(utils.equals(actual, true), message, { 853 throw new CasperError('Invalid constructor.');
854 }
855 return this.assert(subject instanceof constructor, message, {
854 type: "assertInstanceOf", 856 type: "assertInstanceOf",
855 standard: f('Subject is an instance of: "%s"', constructor), 857 standard: f('Subject is an instance of: "%s"', constructor.name),
856 values: { 858 values: {
857 subject: subject, 859 subject: subject,
858 constructor: constructor, 860 constructor: constructor.name,
859 actual: actual 861 actual: actual
860 } 862 }
861 }); 863 });
......