Testing in RxTest with ColdObservables

To show an example of working with a ColdObservable in RxTest, we will duplicate the previous example and change the name.

A ColdObservable in RxTest will only emit when there is a subscriber, and it will emit all its events to each subscriber on subscription. We will create two subscriptions in this example, so rather than using the subscription's dispose() property, we will use disposeBag this time. We will need two observers for this example, so we will duplicate the single one and then rename them as follows:

let disposeBag = DisposeBag()let firstObserver = scheduler.createObserver(Int.self)let secondObserver = scheduler.createObserver(Int.self)

Also, we will need two map Observables to test that ...

Get Reactive Programming with Swift 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.