aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVojta Jina2011-02-04 01:32:55 +0000
committerIgor Minar2011-02-04 14:18:28 -0800
commit9798f5e35fd150c319004c953ed627b5b28dad71 (patch)
tree7e7a4935910710a619d4bd0f64338a0e85a09403 /src
parent94bf24e3b65ba0e3a8a59b35e6c2b24e298c26d3 (diff)
downloadangular.js-9798f5e35fd150c319004c953ed627b5b28dad71.tar.bz2
mock $log: fixed bug, added some tests
I extracted mock $log factory into stand alone function, so we can access it and test, because this service is rewritten by real service during testing, so we can't access it through angular.$service('$log')...
Diffstat (limited to 'src')
-rw-r--r--src/angular-mocks.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js
index bbdcc94d..38163646 100644
--- a/src/angular-mocks.js
+++ b/src/angular-mocks.js
@@ -241,12 +241,14 @@ angular.service('$exceptionHandler', function(e) {
*
* See {@link angular.mock} for more info on angular mocks.
*/
-angular.service('$log', function() {
+angular.service('$log', MockLogFactory);
+
+function MockLogFactory() {
var $log = {
- log: function(){ $log.logs.push(arguments); },
- warn: function(){ $log.logs.push(arguments); },
- info: function(){ $log.logs.push(arguments); },
- error: function(){ $log.logs.push(arguments); }
+ log: function(){ $log.log.logs.push(arguments); },
+ warn: function(){ $log.warn.logs.push(arguments); },
+ info: function(){ $log.info.logs.push(arguments); },
+ error: function(){ $log.error.logs.push(arguments); }
};
$log.log.logs = [];
@@ -255,7 +257,7 @@ angular.service('$log', function() {
$log.error.logs = [];
return $log;
-});
+}
/**