You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know there is already an issue, #1480, discussing this case, and @abdulowork had replied the reason and gave an alternative way to test PublishSubject.
But I don't think the limitation is reasonable since when we test some mechanism using Observable, we not know if this observable is derived from PublishSubject or not.
Moreover, it's possible that developers may change underlying implementation from ReplaySubject to PublishSubject for some reason, and then related test cases failed
Thus, I suggest to fix the behavior of for Observable.toBlocking(). Here is the possible implementation:
privatevardisposeBag:DisposeBag!extensionObservableConvertibleType{publicfunc toBlocking(timeout:TimeInterval?=nil)->BlockingObservable<Element>{letreplaySubject= ReplaySubject<Element>.createUnbounded()
// forward all events to replaySubject
asObservable().subscribe(replaySubject).disposed(by: disposeBag)returnBlockingObservable(timeout: timeout, source: replaySubject)}}
The text was updated successfully, but these errors were encountered:
Where by it's possible to setup an expectation which collects the output of a publisher, then later the expectation can be waited until an output is produced. For example:
Short description of the issue:
I know there is already an issue, #1480, discussing this case, and @abdulowork had replied the reason and gave an alternative way to test PublishSubject.
But I don't think the limitation is reasonable since when we test some mechanism using Observable, we not know if this observable is derived from PublishSubject or not.
Moreover, it's possible that developers may change underlying implementation from ReplaySubject to PublishSubject for some reason, and then related test cases failed
Thus, I suggest to fix the behavior of for
Observable.toBlocking()
. Here is the possible implementation:The text was updated successfully, but these errors were encountered: