Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #15 from carter-thaxton/patch-1
Browse files Browse the repository at this point in the history
Extend sugar to support booleans
  • Loading branch information
Marcin Bunsch committed Mar 23, 2012
2 parents f34fc84 + eb72e1c commit b2a2674
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/jessie/sugar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
exports.sugar = function() {
var Sugar = {
should_be: function(compare) { expect(this).toEqual(compare); },
should_be_value: function(compare) { expect(this.valueOf()).toEqual(compare.valueOf()); },
should_be_a: function(object) { expect(this.constructor).toEqual(object) },
should_be_an_instance_of: function(object) { expect(true).toEqual(this instanceof(object)) },
should_not_be: function(compare) { expect(this).not.toEqual(compare); },
should_not_be_value: function(compare) { expect(this.valueOf()).not.toEqual(compare.valueOf()); },
should_match: function(compare) { expect(this).toMatch(compare); },
should_not_match: function(compare) { expect(this).not.toMatch(compare); },
should_have_been_called: function() { expect(this).toHaveBeenCalled(); },
Expand All @@ -18,14 +20,17 @@ exports.sugar = function() {
String.prototype.emitJasmine = function() { return this };
Number.prototype.emitJasmine = function() { return this };
Array.prototype.emitJasmine = function() { return this };
Boolean.prototype.emitJasmine = function() { return this };

String.prototype.should_be = Sugar.should_be
Number.prototype.should_be = Sugar.should_be
Array.prototype.should_be = Sugar.should_be
Boolean.prototype.should_be = Sugar.should_be_value

String.prototype.should_not_be = Sugar.should_not_be
Number.prototype.should_not_be = Sugar.should_not_be
Array.prototype.should_not_be = Sugar.should_not_be
Boolean.prototype.should_not_be = Sugar.should_not_be_value

String.prototype.should_be_a = Sugar.should_be_a
Number.prototype.should_be_a = Sugar.should_be_a
Expand Down

0 comments on commit b2a2674

Please sign in to comment.