aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular-mocks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/angular-mocks.js')
-rw-r--r--src/angular-mocks.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js
index 4cf4236c..17d317b7 100644
--- a/src/angular-mocks.js
+++ b/src/angular-mocks.js
@@ -657,10 +657,15 @@ angular.module.ngMock.$HttpBackendProvider = function() {
$httpBackend.flush = function(count) {
if (!responses.length) throw Error('No pending request to flush !');
- count = count || responses.length;
- while (count--) {
- if (!responses.length) throw Error('No more pending request to flush !');
- responses.shift()();
+
+ if (angular.isDefined(count)) {
+ while (count--) {
+ if (!responses.length) throw Error('No more pending request to flush !');
+ responses.shift()();
+ }
+ } else {
+ while (responses.length)
+ responses.shift()();
}
};