Allow the clock to be installed for the duration of a single closure

[finish #67434180]
This commit is contained in:
Gregg Van Hove
2015-03-04 17:41:49 -08:00
parent c58d83bbe3
commit ce9600a3f6
2 changed files with 106 additions and 0 deletions

View File

@@ -34,6 +34,15 @@ getJasmineRequireObj().Clock = function() {
installed = false;
};
self.withMock = function(closure) {
this.install();
try {
closure();
} finally {
this.uninstall();
}
};
self.mockDate = function(initialDate) {
mockDate.install(initialDate);
};