createSignalでSignalを生成するロジックを作っていく場合、テストに悩んだので記録を残します。
test.m
//sampleSignalがテスト対象
-(void) testsampleSignal {
XCTestExpectation *expectation = [self expectationWithDescription:@"t"];
RACSignal *t = [RACSignal defer:^RACSignal *{
return [self sampleSignal];
}];
[t subscribeCompleted:^{
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:30 handler:^(NSError *error) {
//後始末処理
}];
}