diff options
| author | Misko Hevery | 2010-05-19 11:51:17 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-19 11:51:17 -0700 |
| commit | 0f73084e9d21cea99f0535e6ca30a1341b7047dc (patch) | |
| tree | e4586731808a708ec0a8ce137c30e99e3cb7201b /test/ResourceSpec.js | |
| parent | 1bdcf72e456c74256b14f98b26e969b9de637614 (diff) | |
| download | angular.js-0f73084e9d21cea99f0535e6ca30a1341b7047dc.tar.bz2 | |
added error handler to xhr requests
Diffstat (limited to 'test/ResourceSpec.js')
| -rw-r--r-- | test/ResourceSpec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js index d2d52d47..2f285bcf 100644 --- a/test/ResourceSpec.js +++ b/test/ResourceSpec.js @@ -138,4 +138,19 @@ describe("resource", function() { expect(person.name).toEqual('misko'); }); + describe('failure mode', function(){ + it('should report error when non 200', function(){ + xhr.expectGET('/CreditCard/123').respond(500, "Server Error"); + var cc = CreditCard.get({id:123}); + try { + xhr.flush(); + fail('expected exception, non thrown'); + } catch (e) { + expect(e.status).toEqual(500); + expect(e.response).toEqual('Server Error'); + expect(e.message).toEqual('500: Server Error'); + } + }); + }); + }); |
