Add specs for mock date

This commit is contained in:
Javier López Pardo
2013-10-25 14:41:32 +02:00
parent fb8bede8ea
commit 81b822fea9
3 changed files with 157 additions and 25 deletions

View File

@@ -15,14 +15,6 @@ getJasmineRequireObj().Clock = function() {
},
installed = false;
if (date) {
var realDate = {
Date: global.Date
},
fakeDate = {
Date: date.Date
};
}
self.install = function(mockDate) {
replace(global, fakeTimingFunctions);
@@ -31,15 +23,13 @@ getJasmineRequireObj().Clock = function() {
if (date && mockDate) {
date.install(mockDate);
replace(global, fakeDate);
}
};
self.uninstall = function() {
delayedFunctionScheduler.reset();
if (date) {
date.reset();
replace(global, realDate);
date.uninstall();
}
replace(global, realTimingFunctions);