diff options
| author | Vojta Jina | 2011-11-01 13:27:42 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-11-30 11:17:24 -0500 |
| commit | 6290bd4587d9752c3b9eabacd20c90010cc330e3 (patch) | |
| tree | 0b0a25505fb4b4892648d46a3a770c21e340dd08 /test/service | |
| parent | e9f81b66316854bdd3a8548f028a64e86fc3e73c (diff) | |
| download | angular.js-6290bd4587d9752c3b9eabacd20c90010cc330e3.tar.bz2 | |
refactor(mock.$httpBackend): rename when().then() to when().respond()
Diffstat (limited to 'test/service')
| -rw-r--r-- | test/service/httpSpec.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/service/httpSpec.js b/test/service/httpSpec.js index 72fd5f8e..8212eb07 100644 --- a/test/service/httpSpec.js +++ b/test/service/httpSpec.js @@ -411,7 +411,7 @@ describe('$http', function() { var future, rawXhrObject; beforeEach(function() { - $httpBackend.when('GET', '/url').then(''); + $httpBackend.when('GET', '/url').respond(''); future = $http({method: 'GET', url: '/url'}); rawXhrObject = MockXhr.$$lastInstance; spyOn(rawXhrObject, 'abort'); @@ -490,7 +490,7 @@ describe('$http', function() { } beforeEach(function() { - $httpBackend.when('GET').then(function(m, url) { + $httpBackend.when('GET').respond(function(m, url) { return [parseInt(url.substr(1)), '', {}]; }); }); @@ -658,7 +658,7 @@ describe('$http', function() { describe('scope.$apply', function() { it('should $apply after success callback', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); $http({method: 'GET', url: '/some'}); $httpBackend.flush(); expect(scope.$apply).toHaveBeenCalledOnce(); @@ -666,7 +666,7 @@ describe('$http', function() { it('should $apply after error callback', function() { - $httpBackend.when('GET').then(404); + $httpBackend.when('GET').respond(404); $http({method: 'GET', url: '/some'}); $httpBackend.flush(); expect(scope.$apply).toHaveBeenCalledOnce(); @@ -674,7 +674,7 @@ describe('$http', function() { it('should $apply even if exception thrown during callback', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); callback.andThrow('error in callback'); $http({method: 'GET', url: '/some'}).on('200', callback); @@ -687,7 +687,7 @@ describe('$http', function() { it('should broadcast $http.request', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); scope.$on('$http.request', callback); var xhrFuture = $http({method: 'GET', url: '/whatever'}); @@ -880,7 +880,7 @@ describe('$http', function() { describe('pendingRequests', function() { it('should be an array of pending requests', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); expect($http.pendingRequests.length).toBe(0); $http({method: 'get', url: '/some'}); @@ -892,7 +892,7 @@ describe('$http', function() { it('should remove the request when aborted', function() { - $httpBackend.when('GET').then(0); + $httpBackend.when('GET').respond(0); future = $http({method: 'get', url: '/x'}); expect($http.pendingRequests.length).toBe(1); @@ -904,7 +904,7 @@ describe('$http', function() { it('should remove the request when served from cache', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); $http({method: 'get', url: '/cached', cache: true}); $httpBackend.flush(); @@ -919,7 +919,7 @@ describe('$http', function() { it('should remove the request before firing callbacks', function() { - $httpBackend.when('GET').then(200); + $httpBackend.when('GET').respond(200); $http({method: 'get', url: '/url'}).on('xxx', function() { expect($http.pendingRequests.length).toBe(0); }); |
