@@ -1189,7 +1189,9 @@ describe('basic usage', function() {
1189
1189
resource . $promise . then ( successSpy , failureSpy ) ;
1190
1190
1191
1191
$httpBackend . flush ( ) ;
1192
- expect ( successSpy ) . toHaveBeenCalledOnce ( ) ;
1192
+ expect ( successSpy ) . toHaveBeenCalledOnceWith ( jasmine . arrayContaining ( [
1193
+ jasmine . objectContaining ( { id : 1 } )
1194
+ ] ) ) ;
1193
1195
expect ( failureSpy ) . not . toHaveBeenCalled ( ) ;
1194
1196
} ) ;
1195
1197
@@ -1215,8 +1217,7 @@ describe('basic usage', function() {
1215
1217
// Ensure the resource promise was rejected
1216
1218
expect ( resource . $resolved ) . toBeTruthy ( ) ;
1217
1219
expect ( successSpy ) . not . toHaveBeenCalled ( ) ;
1218
- expect ( failureSpy ) . toHaveBeenCalledOnce ( ) ;
1219
- expect ( failureSpy ) . toHaveBeenCalledWith ( rejectReason ) ;
1220
+ expect ( failureSpy ) . toHaveBeenCalledOnceWith ( rejectReason ) ;
1220
1221
1221
1222
// Ensure that no requests were made.
1222
1223
$httpBackend . verifyNoOutstandingRequest ( ) ;
@@ -1243,44 +1244,41 @@ describe('basic usage', function() {
1243
1244
resource . $promise . then ( successSpy , failureSpy ) ;
1244
1245
$rootScope . $digest ( ) ;
1245
1246
1246
- expect ( callback ) . toHaveBeenCalledOnce ( ) ;
1247
- expect ( callback ) . toHaveBeenCalledWith ( rejectReason ) ;
1247
+ expect ( callback ) . toHaveBeenCalledOnceWith ( rejectReason ) ;
1248
1248
expect ( successSpy ) . not . toHaveBeenCalled ( ) ;
1249
- expect ( failureSpy ) . toHaveBeenCalledOnce ( ) ;
1250
- expect ( failureSpy ) . toHaveBeenCalledWith ( rejectReason ) ;
1249
+ expect ( failureSpy ) . toHaveBeenCalledOnceWith ( rejectReason ) ;
1251
1250
1252
1251
// Ensure that no requests were made.
1253
1252
$httpBackend . verifyNoOutstandingRequest ( ) ;
1254
1253
} ) ;
1255
1254
1256
1255
it ( 'should abort the operation if a requestErrorInterceptor rejects the operation' , function ( ) {
1257
- var CreditCard = $resource ( '/CreditCard' , { } , {
1258
- query : {
1259
- method : 'get' ,
1260
- isArray : true ,
1261
- interceptor : {
1262
- request : function ( ) {
1263
- return $q . reject ( rejectReason ) ;
1264
- } ,
1265
- requestError : function ( rejection ) {
1266
- return $q . reject ( rejection ) ;
1267
- }
1256
+ var CreditCard = $resource ( '/CreditCard' , { } , {
1257
+ query : {
1258
+ method : 'get' ,
1259
+ isArray : true ,
1260
+ interceptor : {
1261
+ request : function ( ) {
1262
+ return $q . reject ( rejectReason ) ;
1263
+ } ,
1264
+ requestError : function ( rejection ) {
1265
+ return $q . reject ( rejection ) ;
1268
1266
}
1269
1267
}
1270
- } ) ;
1268
+ }
1269
+ } ) ;
1271
1270
1272
- var resource = CreditCard . query ( ) ;
1273
- resource . $promise . then ( successSpy , failureSpy ) ;
1274
- $rootScope . $apply ( ) ;
1271
+ var resource = CreditCard . query ( ) ;
1272
+ resource . $promise . then ( successSpy , failureSpy ) ;
1273
+ $rootScope . $apply ( ) ;
1275
1274
1276
- expect ( resource . $resolved ) . toBeTruthy ( ) ;
1277
- expect ( successSpy ) . not . toHaveBeenCalled ( ) ;
1278
- expect ( failureSpy ) . toHaveBeenCalledOnce ( ) ;
1279
- expect ( failureSpy ) . toHaveBeenCalledWith ( rejectReason ) ;
1275
+ expect ( resource . $resolved ) . toBeTruthy ( ) ;
1276
+ expect ( successSpy ) . not . toHaveBeenCalled ( ) ;
1277
+ expect ( failureSpy ) . toHaveBeenCalledOnceWith ( rejectReason ) ;
1280
1278
1281
- // Ensure that no requests were made.
1282
- $httpBackend . verifyNoOutstandingRequest ( ) ;
1283
- } ) ;
1279
+ // Ensure that no requests were made.
1280
+ $httpBackend . verifyNoOutstandingRequest ( ) ;
1281
+ } ) ;
1284
1282
1285
1283
it ( 'should continue the operation if a requestErrorInterceptor rescues it' , function ( ) {
1286
1284
var CreditCard = $resource ( '/CreditCard' , { } , {
@@ -1305,8 +1303,11 @@ describe('basic usage', function() {
1305
1303
$httpBackend . flush ( ) ;
1306
1304
1307
1305
expect ( resource . $resolved ) . toBeTruthy ( ) ;
1308
- expect ( successSpy ) . toHaveBeenCalledOnce ( ) ;
1306
+ expect ( successSpy ) . toHaveBeenCalledOnceWith ( jasmine . arrayContaining ( [
1307
+ jasmine . objectContaining ( { id : 1 } )
1308
+ ] ) ) ;
1309
1309
expect ( failureSpy ) . not . toHaveBeenCalled ( ) ;
1310
+
1310
1311
$httpBackend . verifyNoOutstandingRequest ( ) ;
1311
1312
} ) ;
1312
1313
} ) ;
@@ -2038,7 +2039,7 @@ describe('handling rejections', function() {
2038
2039
failureSpy = jasmine . createSpy ( 'failureSpy' ) ;
2039
2040
callback = jasmine . createSpy ( ) ;
2040
2041
} ) ) ;
2041
-
2042
+
2042
2043
it ( 'should call requestErrorInterceptor if requestInterceptor throws an error' , function ( ) {
2043
2044
var CreditCard = $resource ( '/CreditCard' , { } , {
2044
2045
query : {
0 commit comments