LoginSignup
3
3

More than 5 years have passed since last update.

ReactiveCocoaでテスト(createSignalで作ったsignalのテスト)

Posted at

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) {
    //後始末処理
    }];

}
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3