diff options
| author | simpulton | 2012-04-20 01:31:25 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-04-20 12:32:33 -0700 |
| commit | e61fd1b43a55496c11c63da7ca2fc05b88d44043 (patch) | |
| tree | 007761363c98350ea42cda871b73dfb62d49b1a0 /test/ngResource/resourceSpec.js | |
| parent | ce15a3e0491f7acafcdf0ff07f75d0c2c9819164 (diff) | |
| download | angular.js-e61fd1b43a55496c11c63da7ca2fc05b88d44043.tar.bz2 | |
feat($resource): support HTTP PATCH method
Properly serialize data into request body instead of url.
Closes #887
Diffstat (limited to 'test/ngResource/resourceSpec.js')
| -rw-r--r-- | test/ngResource/resourceSpec.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index 3235a6d0..2981732c 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -11,6 +11,9 @@ describe("resource", function() { charge:{ method:'POST', params:{verb:'!charge'} + }, + patch: { + method: 'PATCH' } }); callback = jasmine.createSpy(); @@ -235,6 +238,20 @@ describe("resource", function() { }); + it("should patch a resource", function() { + $httpBackend.expectPATCH('/CreditCard/123', '{"name":"igor"}'). + respond({id: 123, name: 'rama'}); + + var card = CreditCard.patch({id: 123}, {name: 'igor'}, callback); + + expect(card).toEqualData({name: 'igor'}); + expect(callback).not.toHaveBeenCalled(); + $httpBackend.flush(); + expect(callback).toHaveBeenCalled(); + expect(card).toEqualData({id: 123, name: 'rama'}); + }); + + it('should create on save', function() { $httpBackend.expect('POST', '/CreditCard', '{"name":"misko"}').respond({id: 123}, {header1: 'a'}); |
