Skip to content

Commit 4d5c10f

Browse files
committed
Added test for mgonto#728
1 parent 5feed3d commit 4d5c10f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/restangularSpec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,20 @@ describe("Restangular", function() {
557557

558558
$httpBackend.flush();
559559
});
560+
561+
it("putElement() should pass a restangularCollection to the callback", function() {
562+
$httpBackend.expectGET('/accounts');
563+
restangularAccounts.getList().then(function(accounts) {
564+
expect(accounts.restangularCollection).toBe(true);
565+
accounts[1].amount += 1;
566+
$httpBackend.expectPUT('/accounts/1');
567+
accounts.putElement(1).then(function(newAccounts) {
568+
expect(newAccounts.restangularCollection).toBe(true);
569+
expect(newAccounts.putElement).toBeDefined();
570+
});
571+
});
572+
$httpBackend.flush();
573+
})
560574
});
561575

562576
describe("Scoped Service", function() {

0 commit comments

Comments
 (0)