Putting this in SpecHelper.js actually seems to do the trick. Should this be in the docs somewhere?
beforeEach(function () {
this.addMatchers({
toHaveClass: function (expectedClass) {
var node = this.actual;
this.message = function (expectedClass) {
return [
"expected tag to have class (" + expectedClass + "), but it only had classes (" + this.actual.attr('class') + ")",
"expected tag not to have class (" + expectedClass + "), but it did",
]; }
return node.hasClass(expectedClass);
}
})
});
----
Jeremy Lightsmith
Helping Software Teams Get More Productive with tools like Agile, Lean, & Rails
312-953-1193http://jeremylightsmith.com/http://facilitationpatterns.org/ (book in progress)
http://www.linkedin.com/in/jeremylightsmith