aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular-mocks.js
diff options
context:
space:
mode:
authorIgor Minar2011-02-04 13:00:46 -0800
committerIgor Minar2011-02-04 14:11:52 -0800
commit568574b915086bcb1f08e3f8903ef79497c97435 (patch)
treed1cbd0997f97a1bd9ce0592cd919542984afc868 /src/angular-mocks.js
parent46d690ff0188836688811dda9af1b99c44750c48 (diff)
downloadangular.js-568574b915086bcb1f08e3f8903ef79497c97435.tar.bz2
mock's .xhr.flush() should throw exception when there is nothing to flush
Diffstat (limited to 'src/angular-mocks.js')
-rw-r--r--src/angular-mocks.js4
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()();
}