diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/angular-mocks.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/angular-mocks.js b/src/angular-mocks.js index 71a18d06..bbdcc94d 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -142,6 +142,10 @@ function MockBrowser() { self.xhr.expectPUT = angular.bind(self, self.xhr.expect, 'PUT'); self.xhr.expectJSON = angular.bind(self, self.xhr.expect, 'JSON'); self.xhr.flush = function() { + if (requests.length == 0) { + throw new Error("No xhr requests to be flushed!"); + } + while(requests.length) { requests.pop()(); } |
