Commit c8764da9 c8764da9946cc6fc3b88057e256380a3f432eb0f by Mickaël Andrieu

refs #602 Pass all travis tests

1 parent 33271089
......@@ -849,15 +849,15 @@ Tester.prototype.assertType = function assertType(subject, type, message) {
*/
Tester.prototype.assertInstanceOf = function assertInstanceOf(subject, className, message) {
"use strict";
if (utils.betterTypeOf(constructor) !== "function") {
if (utils.betterTypeOf(subject.constructor) !== "function") {
throw new CasperError('Subject is null or undefined.');
}
return this.assert(utils.equals(subject.constructor.name, className), message, {
type: "assertInstanceOf",
standard: f('Subject is an instance of: "%s"', constructor.name),
standard: f('Subject is an instance of: "%s"', subject.constructor.name),
values: {
subject: subject,
constructor: constructor.name,
className: className,
}
});
};
......
......@@ -2,7 +2,7 @@
/*jshint strict:false, maxstatements:99*/
var fs = require('fs');
casper.test.begin('Common assertions tests', 50, function(test) {
casper.test.begin('Common assertions tests', 49, function(test) {
casper.start('tests/site/index.html', function() {
test.assertTextExists('form', 'Tester.assertTextExists() checks that page body contains text');
test.assertTextExist('form', 'Tester.assertTextExist() checks that page body contains text [alias]');
......@@ -60,15 +60,13 @@ casper.test.begin('Common assertions tests', 50, function(test) {
test.assertTitleMatch(/test index/, 'Tester.assertTitleMatch() works as expected');
test.assertTitleMatches(/test index/, 'Tester.assertTitleMatches() works as expected [alias]');
test.assertType("plop", "string", "Tester.assertType() works as expected");
// We need two objects to test inheritance case
function Cow(){}; function SuperCow(){}; SuperCow.prototype = new Cow;
var daisy = new Cow(); var superCowie = new SuperCow();
// we need a class and an instance of this class
function Cow(){} var daisy = new Cow();
test.assertInstanceOf(12, "Number", "Tester.assertInstanceOf() works as expected");
test.assertInstanceOf("Boo", "String", "Tester.assertInstanceOf() works as expected");
test.assertInstanceOf(["moo", "bar"], "Array", "Tester.assertInstanceOf() works as expected")
test.assertInstanceOf(true, "Boolean", "Test.assertInstanceOf() works as expected");
test.assertInstanceOf(daisy, "Cow", "Tester.assertInstanceOf() works as expected");
test.assertInstanceOf(superCowie, "SuperCow", "Tester.assertInstanceOf() works as expected");
test.assertUrlMatch(/index\.html$/, "Tester.assertUrlMatch() works as expected");
test.assertUrlMatches(/index\.html$/, "Tester.assertUrlMatches() works as expected [alias]");
test.assertVisible('img', 'Tester.assertVisible() works as expected');
......