Test responseImage on success and failure
This commit is contained in:
parent
877a5a46fd
commit
648b4fb77f
1 changed files with 18 additions and 0 deletions
|
|
@ -56,4 +56,22 @@
|
||||||
expect(operation.error).willNot.beNil();
|
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
|
@end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue