From 8cea8497d92b5e11827159c254ad9284100a8e52 Mon Sep 17 00:00:00 2001 From: Marcelo Gobetti Date: Mon, 22 Oct 2018 19:57:40 -0300 Subject: [PATCH] Added RxTest support to Changelog and updated README --- Changelog.md | 2 +- README.md | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 55e4041..703d9f3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ ## Current Master -- Nothing yet. +- Added support to RxTest. Users may now choose between `RxTest` and `RxBlocking` (or both) ## 4.3.0 - Swift 4.2 support diff --git a/README.md b/README.md index d2a0aaa..2318660 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,48 @@ expect(observable).first == 42 Nice. +--- + +If on the other hand you'd rather use [RxTest](http://cocoapods.org/pods/RxTest) instead of `RxBlocking`, you can do it by specifying RxNimble's `RxTest` subspec. With _RxTest_ you can have more powerful tests, checking a stream as a whole instead of being limited to `first`, `last` and `array` (while the last 2 implicitly require the stream to have completed). + +That means _RxTest_ allows you to verify the occurrence of multiple `next`, `error` and `completed` events at specific virtual times: + +``` +expect(subject).events(scheduler: scheduler, disposeBag: disposeBag) + .to(equal([ + Recorded.next(5, "Hello"), + Recorded.next(10, "World"), + Recorded.completed(100) + ])) +``` + +You may also verify specific error types: + +``` +expect(imageSubject).events(scheduler: scheduler, disposeBag: disposeBag) + .to(equal([ + Recorded.error(5, ImageError.invalidImage) + ])) +``` + ## Installation -Add to your podfile: +Add to the tests target in your Podfile: + +```rb +pod 'RxNimble' # same as RxNimble/RxBlocking +``` + +or + +```rb +pod 'RxNimble/RxTest' # installs RxTest instead of RxBlocking +``` + +or even ```rb -pod 'RxNimble' +pod 'RxNimble', subspecs: ['RxBlocking', 'RxTest'] # installs both dependencies ``` And `pod install` and that's it!