Skip to content

Commit ecf4bc0

Browse files
committed
Fix up tests
1 parent 1a8fbe0 commit ecf4bc0

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

test/restangularSpec.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ describe("Restangular", function() {
5252
$httpBackend.whenGET("/accounts/post-something/foo").respond(fooModel);
5353
$httpBackend.whenPUT("/accounts/put-something").respond(fooModel);
5454
$httpBackend.whenGET("/accounts/put-something/foo").respond(fooModel);
55+
$httpBackend.whenPUT("/accounts/put-something/foo").respond(fooModel);
5556
$httpBackend.whenDELETE("/accounts/delete-something").respond(fooModel);
5657
$httpBackend.whenGET("/accounts/delete-something/foo").respond(fooModel);
5758
$httpBackend.whenJSONP("/accounts").respond(accountsModel);
@@ -571,7 +572,6 @@ describe("Restangular", function() {
571572
});
572573

573574
describe("Scoped Service", function() {
574-
575575
it("should correctly work", function() {
576576
var Accounts = Restangular.service('accounts');
577577
Accounts.post(newAccount);
@@ -640,37 +640,39 @@ describe("Restangular", function() {
640640
$httpBackend.flush();
641641
});
642642

643-
it("should support post", function() {
644-
Accounts.postSomething({foo: 'bar'}).then(function(postSomething) {
645-
postSomething.one('foo').get();
646-
});
647-
648-
$httpBackend.expectPOST('/accounts/post-something', {foo: 'bar'});
649-
$httpBackend.expectGET('/accounts/post-something/foo');
650-
$httpBackend.flush();
651-
});
652-
653-
it("should support put", function() {
654-
Accounts.putSomething({foo: 'bar'}).then(function(putSomething) {
655-
putSomething.one('foo').get();
656-
});
643+
it("should support post", function() {
644+
Accounts.postSomething({foo: 'bar'}).then(function(postSomething) {
645+
postSomething.one('foo').get();
646+
});
647+
$httpBackend.expectPOST('/accounts/post-something', {foo: 'bar'});
648+
$httpBackend.expectGET('/accounts/post-something/foo');
649+
$httpBackend.flush();
650+
});
657651

658-
$httpBackend.expectPUT('/accounts/put-something', {foo: 'bar'});
659-
$httpBackend.expectGET('/accounts/put-something/foo');
660-
$httpBackend.flush();
661-
});
652+
it("should support put", function() {
653+
Accounts.putSomething({foo: 'bar'}).then(function(putSomething) {
654+
putSomething.one('foo').get();
655+
var a = putSomething.one('foo');
656+
a.foo = 'bar';
657+
a.put();
658+
});
659+
$httpBackend.expectPUT('/accounts/put-something', {foo: 'bar'});
660+
$httpBackend.expectGET('/accounts/put-something/foo');
661+
$httpBackend.expectPUT('/accounts/put-something/foo', {foo: 'bar'});
662+
$httpBackend.flush();
663+
});
662664

663-
it("should support delete", function() {
664-
Accounts.deleteSomething().then(function(deleteSomething) {
665-
deleteSomething.one('foo').get();
666-
});
665+
it("should support delete", function() {
666+
Accounts.deleteSomething().then(function(deleteSomething) {
667+
deleteSomething.one('foo').get();
668+
});
667669

668-
$httpBackend.expectDELETE('/accounts/delete-something');
669-
$httpBackend.expectGET('/accounts/delete-something/foo');
670-
$httpBackend.flush();
671-
});
672-
});
673-
});
670+
$httpBackend.expectDELETE('/accounts/delete-something');
671+
$httpBackend.expectGET('/accounts/delete-something/foo');
672+
$httpBackend.flush();
673+
});
674+
});
675+
});
674676

675677
describe("ONE", function() {
676678
it("get() should return a JSON item", function() {

0 commit comments

Comments
 (0)