Test responseImage on success and failure
This commit is contained in:
parent
877a5a46fd
commit
648b4fb77f
@ -56,4 +56,22 @@
|
||||
expect(operation.error).willNot.beNil();
|
||||
}
|
||||
|
||||
- (void)testThatImageResponseIsNotNilWhenRequestSucceeds {
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/response-headers?Content-Type=image/png" relativeToURL:self.baseURL]];
|
||||
AFImageRequestOperation *operation = [[AFImageRequestOperation alloc] initWithRequest:request];
|
||||
[operation start];
|
||||
|
||||
expect([operation isFinished]).will.beTruthy();
|
||||
expect(operation.responseImage).willNot.beNil();
|
||||
}
|
||||
|
||||
- (void)testThatImageResponseIsNilWhenRequestFails {
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/status/404" relativeToURL:self.baseURL]];
|
||||
AFImageRequestOperation *operation = [[AFImageRequestOperation alloc] initWithRequest:request];
|
||||
[operation start];
|
||||
|
||||
expect([operation isFinished]).will.beTruthy();
|
||||
expect(operation.responseImage).will.beNil();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user