Created
January 18, 2011 18:56
-
-
Save lukeredpath/784929 to your computer and use it in GitHub Desktop.
Keeping tests readable and fluent!
This file contains 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)testCanPerformGetRequestToResourceAndExtractTheResponseAsAString | |
{ | |
mimicGET(@"/simple/resource", andReturnBody(@"plain text response"), ^{ | |
[client get:resourceWithPath(@"/simple/resource") delegate:self]; | |
}); | |
assertEventuallyThat(&lastResponse, is(responseWithStatusAndBody(200, @"plain text response"))); | |
} | |
- (void)testCanPostStringToResourceAndHaveThatValueEchoedBack | |
{ | |
__block LRRestyResponse *receivedResponse = nil; | |
mimicPOST(@"/echo/test", andEchoRequest(), ^{ | |
[client post:resourceWithPath(@"/echo/test") payload:@"hello world" withBlock:^(LRRestyResponse *response) { | |
receivedResponse = [response retain]; | |
}]; | |
}); | |
assertEventuallyThat(&receivedResponse, is(responseWithRequestEcho(@"body", @"hello world"))); | |
mimicPOST(@"/echo/test", andEchoRequest(), ^{ | |
[client post:resourceWithPath(@"/echo/test") payload:@"Resty rocks!" withBlock:^(LRRestyResponse *response) { | |
receivedResponse = [response retain]; | |
}]; | |
}); | |
assertEventuallyThat(&receivedResponse, is(responseWithRequestEcho(@"body", @"Resty rocks!"))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment