Skip to content
Snippets Groups Projects
Commit 2e49a355 authored by murgatroid99's avatar murgatroid99
Browse files

Fixed KVO test

parent 81b4fcbe
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ static ProtoMethod *kUnaryCallMethod;
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
_callback(keyPath, object, change);
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
[object removeObserver:self forKeyPath:keyPath];
}
@end
......@@ -219,16 +219,16 @@ static ProtoMethod *kUnaryCallMethod;
__weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."];
__weak XCTestExpectation *metadata = [self expectationWithDescription:@"Metadata changed."];
PassthroughObserver *observer = [[PassthroughObserver alloc] initWithCallback:^(NSString *keypath, id object, NSDictionary * change) {
if (keypath == @"responseHeaders") {
[expectation fulfill];
}
}]
GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress
path:kEmptyCallMethod.HTTPPath
requestsWriter:[GRXWriter writerWithValue:[NSData data]]];
PassthroughObserver *observer = [[PassthroughObserver alloc] initWithCallback:^(NSString *keypath, id object, NSDictionary * change) {
if ([keypath isEqual: @"responseHeaders"]) {
[metadata fulfill];
}
}];
[call addObserver:observer forKeyPath:@"responseHeaders" options:0 context:NULL];
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment