aboutsummaryrefslogtreecommitdiffstats
path: root/test/ResourceSpec.js
diff options
context:
space:
mode:
authorIgor Minar2011-12-01 16:20:08 -0500
committerIgor Minar2011-12-01 16:20:08 -0500
commit44b2f44f93afe226196cb11acb03eb2fa2de04c1 (patch)
tree97f65bef1b6fc66ffc7d5122ee3920e84b6f039f /test/ResourceSpec.js
parent1d14760c6d3eefb676f5670bc323b2a7cadcdbfa (diff)
downloadangular.js-44b2f44f93afe226196cb11acb03eb2fa2de04c1.tar.bz2
fix($resource): forwardport exposing headers from 0.9.19
Diffstat (limited to 'test/ResourceSpec.js')
-rw-r--r--test/ResourceSpec.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/ResourceSpec.js b/test/ResourceSpec.js
index 6045bd30..7ee7aec8 100644
--- a/test/ResourceSpec.js
+++ b/test/ResourceSpec.js
@@ -107,7 +107,9 @@ describe("resource", function() {
$httpBackend.flush();
nakedExpect(cc).toEqual({id: 123, name: 'misko'});
- expect(callback).toHaveBeenCalledWith(cc);
+ expect(callback).toHaveBeenCalledOnce();
+ expect(callback.mostRecentCall.args[0]).toEqual(cc);
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
}));
it("should read resource", inject(function($httpBackend) {
@@ -120,7 +122,8 @@ describe("resource", function() {
$httpBackend.flush();
nakedExpect(cc).toEqual({id: 123, number: '9876'});
- expect(callback).toHaveBeenCalledWith(cc);
+ expect(callback.mostRecentCall.args[0]).toEqual(cc);
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
}));
it("should read partial resource", inject(function($httpBackend) {
@@ -137,7 +140,8 @@ describe("resource", function() {
$httpBackend.expect('GET', '/CreditCard/123').respond({id: {key: 123}, number: '9876'});
cc.$get(callback);
$httpBackend.flush();
- expect(callback).toHaveBeenCalledWith(cc);
+ expect(callback.mostRecentCall.args[0]).toEqual(cc);
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
expect(cc.number).toEqual('9876');
}));
@@ -160,7 +164,8 @@ describe("resource", function() {
$httpBackend.flush();
nakedExpect(ccs).toEqual([{id:1}, {id:2}]);
- expect(callback).toHaveBeenCalledWith(ccs);
+ expect(callback.mostRecentCall.args[0]).toEqual(ccs);
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
}));
it("should have all arguments optional", inject(function($httpBackend) {
@@ -180,7 +185,8 @@ describe("resource", function() {
expect(callback).not.toHaveBeenCalled();
$httpBackend.flush();
- nakedExpect(callback.mostRecentCall.args).toEqual([{}]);
+ nakedExpect(callback.mostRecentCall.args[0]).toEqual({});
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
callback.reset();
$httpBackend.expect('DELETE', '/CreditCard/333').respond(204, null);
@@ -188,7 +194,8 @@ describe("resource", function() {
expect(callback).not.toHaveBeenCalled();
$httpBackend.flush();
- nakedExpect(callback.mostRecentCall.args).toEqual([{}]);
+ nakedExpect(callback.mostRecentCall.args[0]).toEqual({});
+ expect(callback.mostRecentCall.args[1]()).toEqual({});
}));
it('should post charge verb', inject(function($httpBackend) {
@@ -205,7 +212,7 @@ describe("resource", function() {
}));
it('should create on save', inject(function($httpBackend) {
- $httpBackend.expect('POST', '/CreditCard', '{"name":"misko"}').respond({id: 123});
+ $httpBackend.expect('POST', '/CreditCard', '{"name":"misko"}').respond({id: 123}, {header1: 'a'});
var cc = new CreditCard();
expect(cc.$get).toBeDefined();
@@ -219,7 +226,8 @@ describe("resource", function() {
$httpBackend.flush();
nakedExpect(cc).toEqual({id:123});
- expect(callback).toHaveBeenCalledWith(cc);
+ expect(callback.mostRecentCall.args[0]).toEqual(cc);
+ expect(callback.mostRecentCall.args[1]()).toEqual({header1: 'a'});
}));
it('should not mutate the resource object if response contains no body', inject(function($httpBackend) {