Throw error if you define a spy outside of a runnable

[#66789174]
This commit is contained in:
Christopher Amavisca and Greg Cobb
2014-03-05 14:27:19 -08:00
parent b200952195
commit a2ac5ef3b6
3 changed files with 29 additions and 0 deletions

View File

@@ -201,6 +201,9 @@ getJasmineRequireObj().Env = function(j$) {
};
var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
if(!currentRunnable()) {
throw new Error('Spies must be created in a before function or a spec');
}
return runnableResources[currentRunnable().id].spies;
}});