Skip to content

Instantly share code, notes, and snippets.

@tibr
Created Jun 14, 2013
Embed
What would you like to do?
stub context example
context(@"success", ^{
beforeEach(^{
[OHHTTPStubs shouldStubRequestsPassingTest:^BOOL(NSURLRequest *request) {
NSString *expectedPath = @"/3/configuration";
BOOL shouldStub = [[request.URL path] isEqualToString:expectedPath];
return shouldStub;
} withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
OHHTTPStubsResponse *response = [OHHTTPStubsResponse responseWithFile:@"configuration.json"
contentType:@"application/json"
responseTime:0.0];
return response;
}];
});
it(@"should parse something", ^{
});
it(@"should do something else", ^{
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment