I'm using protractor with jasmine 1.3, tried adding a custom matcher to my spec using the example here
beforeEach(function () {
utils.log("beforeEach");
this.addMatchers({
toBeGoofy: function (expected) {
if (expected === undefined) {
expected = '';
}
var pass = this.actual.hyuk === "gawrsh" + expected;
if (pass) {
this.message = "Expected " + this.actual + " not to be quite so goofy";
} else {
this.message = "Expected " + this.actual + " to be goofy, but it was not very goofy";
}
return pass;
},
});
});
note that I didn't change anything from their example. after that, i try using it inside an "it" like that:
expect({ "hyuk": "j" }).toBeGoofy();
and i get an error:
TypeError: undefined is not a function
on the line that the matcher was used on.. any help?
Aucun commentaire:
Enregistrer un commentaire