Created
December 14, 2009 04:25
-
-
Save jerodsanto/255768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2009-11-13 22:25:12.422 Cappuccino [warn]: undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)save | |
{ | |
var request = [self resourceWillSave]; | |
if (!request) | |
return NO; | |
var response = [CPURLConnection sendSynchronousRequest:request]; | |
// console.log(response[0]); | |
CPLog.warn(response[0]); | |
if (response[0] >= 400) | |
return NO; | |
else | |
return YES; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)testSuccessfulSaveWithNewResource | |
{ | |
var oldCPURLConnection = CPURLConnection; | |
var response = [201,'{"user":{"email":"[email protected]","password":"secret"}}']; | |
CPURLConnection = moq(); | |
[CPURLConnection selector:@selector(sendSynchronousRequest:) arguments:[CPArray array] returns:response]; | |
[self assert:YES equals:[user save]]; | |
[CPURLConnection verifyThatAllExpectationsHaveBeenMet]; | |
CPURLConnection = oldCPURLConnection; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment