Skip to content

Instantly share code, notes, and snippets.

@petyosi
Created September 21, 2009 08:00
Show Gist options
  • Save petyosi/190127 to your computer and use it in GitHub Desktop.
Save petyosi/190127 to your computer and use it in GitHub Desktop.
function describe(description, block) {
$(document).ready(function() {
module(description);
block();
});
}
function the(what) {
return {
should : function(matcher) {
ok(matcher.against(what), matcher.positiveDescription());
},
shouldNot : function(matcher) {
ok(!matcher.against(what), matcher.negativeDescription());
}
}
}
function it(description, block) {
test(description, block);
}
function equal(expected) {
return {
positiveDescription : function() {
return this.lastMatchedAgainst + " should equal " + expected;
},
negativeDescription : function() {
return this.lastMatchedAgainst + " should not equal " + expected;
},
against : function(obj) {
this.lastMatchedAgainst = obj;
return obj == expected;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment