Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Jasmine for automated Tests
- Loading branch information
Arian
committed
Sep 8, 2010
1 parent
72fab64
commit 6d5ab6a
Showing
10 changed files
with
5,066 additions
and
6 deletions.
There are no files selected for viewing
Submodule Packager
updated
3 files
+6 −6 | helpers/array.php | |
+7 −7 | packager | |
+21 −21 | packager.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
value_of = expect; | ||
|
||
(function(prototype){ | ||
|
||
prototype.should_be = prototype.toEqual; | ||
prototype.should_not_be = prototype.toNotEqual; | ||
|
||
prototype.should_be_true = prototype.toBeTruthy; | ||
prototype.should_be_false = prototype.toBeFalsy; | ||
prototype.should_be_null = prototype.toBeNull; | ||
prototype.should_match = prototype.toMatch; | ||
prototype.should_be_empty = function(){ | ||
return !this.actual || (this.actual.length == 0); | ||
}; | ||
|
||
})(jasmine.Matchers.prototype); | ||
|
||
describe = (function(original){ | ||
var each = 'before each', | ||
all = 'before all', | ||
after = 'after all'; | ||
|
||
return function(name, object){ | ||
if (object instanceof Function){ | ||
original(name, object); | ||
return; | ||
} | ||
|
||
original(name, function(){ | ||
var beforeAll = object[all], | ||
bfEach = object[each], | ||
aAll = object[after]; | ||
|
||
beforeEach(function(){ | ||
if (beforeAll){ | ||
beforeAll(); | ||
beforeAll = null; | ||
} | ||
|
||
if (bfEach) bfEach(); | ||
}); | ||
|
||
delete object[all]; | ||
delete object[each]; | ||
delete object[after]; | ||
|
||
for (var key in object) | ||
it(key, object[key]); | ||
|
||
if (aAll) it('cleans up', aAll); | ||
}); | ||
}; | ||
})(describe); |
Oops, something went wrong.