Skip to content

Instantly share code, notes, and snippets.

@tibr
Created June 14, 2013 12:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibr/5781595 to your computer and use it in GitHub Desktop.
Save tibr/5781595 to your computer and use it in GitHub Desktop.
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