aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2014-03-17 15:50:24 -0700
committerIgor Minar2014-03-18 12:01:35 -0700
commit922cb7e42f1ff6c3f39342b96be472048ad9cb25 (patch)
tree770f1e4d4d984b76d20cdb69ef73ab2127c12fbd
parent103cb513d93109e3af37268ea176e89d4883431b (diff)
downloadangular.js-922cb7e42f1ff6c3f39342b96be472048ad9cb25.tar.bz2
chore(log): add `log.empty()` method to the testing logger
`log.empty()` is the same as `log.reset()`, except thati `empty()` also returns the current array with messages instead of: ``` // do work expect(log).toEqual(['bar']); log.reset(); ``` do: ``` // do work expect(log.empty()).toEqual(['bar']); ```
-rw-r--r--test/helpers/testabilityPatch.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/helpers/testabilityPatch.js b/test/helpers/testabilityPatch.js
index f61be4ee..34b6b78a 100644
--- a/test/helpers/testabilityPatch.js
+++ b/test/helpers/testabilityPatch.js
@@ -269,21 +269,27 @@ function provideLog($provide) {
log.toString = function() {
return messages.join('; ');
- }
+ };
log.toArray = function() {
return messages;
- }
+ };
log.reset = function() {
messages = [];
+ };
+
+ log.empty = function() {
+ var currentMessages = messages;
+ messages = [];
+ return currentMessages;
}
log.fn = function(msg) {
return function() {
log(msg);
- }
- }
+ };
+ };
log.$$log = true;