aboutsummaryrefslogtreecommitdiffstats
path: root/test/testabilityPatch.js
diff options
context:
space:
mode:
authorMisko Hevery2011-11-02 16:32:46 -0700
committerMisko Hevery2011-11-14 16:39:33 -0800
commitbd04316a89a0909e7a4e483839d573ce857f7622 (patch)
tree0378c33976ba524b7090a3665cd7729638f1545e /test/testabilityPatch.js
parented36b9da3be338fe9eb36f3eeea901d6f51cd768 (diff)
downloadangular.js-bd04316a89a0909e7a4e483839d573ce857f7622.tar.bz2
refactor(services): migrate angular.service -> module
Diffstat (limited to 'test/testabilityPatch.js')
-rw-r--r--test/testabilityPatch.js29
1 files changed, 3 insertions, 26 deletions
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js
index eb98cb6f..4d576ab9 100644
--- a/test/testabilityPatch.js
+++ b/test/testabilityPatch.js
@@ -77,18 +77,13 @@ beforeEach(function() {
}
});
- $logMock.log.logs = [];
- $logMock.warn.logs = [];
- $logMock.info.logs = [];
- $logMock.error.logs = [];
-
});
function inject(){
var blockFns = sliceArgs(arguments);
return function(){
var spec = this;
- spec.$injector = spec.$injector || angular.injector('NG');
+ spec.$injector = spec.$injector || angular.injector('NG', 'NG_MOCK');
angular.forEach(blockFns, function(fn){
spec.$injector.invoke(spec, fn);
});
@@ -96,30 +91,12 @@ function inject(){
}
-afterEach(inject(function($rootScope) {
+afterEach(inject(function($rootScope, $log) {
// release the injector
dealoc($rootScope);
// check $log mock
- forEach(['error', 'warn', 'info', 'log'], function(logLevel) {
- if ($logMock[logLevel].logs.length) {
- forEach($logMock[logLevel].logs, function(log) {
- forEach(log, function deleteStack(logItem) {
- if (logItem instanceof Error) {
- dump(logItem.stack);
- delete logItem.stack;
- delete logItem.arguments;
- } else {
- dump(logItem);
- }
- });
- });
-
- throw new Error("Exprected $log." + logLevel + ".logs array to be empty. " +
- "Either a message was logged unexpectedly, or an expected log message was not checked " +
- "and removed. Array contents: " + toJson($logMock[logLevel].logs));
- }
- });
+ $log.assertEmpty && $log.assertEmpty();
clearJqCache();
}));