Skip to content

Commit

Permalink
Added docs to RxTest methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gobetti committed Oct 22, 2018
1 parent 67e9eb1 commit 6dd63fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Source/RxTest/Equal+RxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Nimble
import RxSwift
@testable import RxTest

/// A Nimble matcher that succeeds when the actual events are equal to the expected events.
public func equal<T: Equatable>(_ expectedEvents: RecordedEvents<T>) -> Predicate<RecordedEvents<T>> {
return Predicate.define { actualEvents in
let actualEquatableEvents = try actualEvents.evaluate()?.map { AnyEquatable(target: $0, comparer: ==) }
Expand Down
7 changes: 7 additions & 0 deletions Source/RxTest/Expectation+RxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import RxTest
public typealias RecordedEvents<E> = [Recorded<Event<E>>]

public extension Expectation where T: ObservableType {
/// Make an expectation on the events emitted by an observable.
///
/// - Parameters:
/// - scheduler: the scheduler used to record events in virtual time units.
/// - disposeBag: the dispose bag that will dispose all of its resources between tests.
/// - initialTime: the time at which subscription/recording should begin.
/// - Returns: an expectation of the actual events emitted by the observable.
func events(scheduler: TestScheduler,
disposeBag: DisposeBag,
startAt initialTime: Int = 0) -> Expectation<RecordedEvents<T.E>> {
Expand Down
2 changes: 2 additions & 0 deletions Source/RxTest/ThrowError+RxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Nimble
import RxSwift
import RxTest

/// A Nimble matcher that succeeds when the actual events emit an error
/// of any type.
public func throwError<T: Equatable>() -> Predicate<RecordedEvents<T>> {
func extractError(_ recorded: RecordedEvents<T>?) -> [Error]? {
func extractError<E>(_ recorded: Recorded<Event<E>>) -> Error? {
Expand Down

0 comments on commit 6dd63fd

Please sign in to comment.