Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Current Master

- Nothing yet.
- Rename `Predicate` to `Matcher` to support Xcode 15.

## 6.3.0

Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/ReactiveX/RxSwift", .upToNextMajor(from: "6.0.0")),
.package(url: "https://github.com/Quick/Nimble", .upToNextMajor(from: "12.0.0")),
.package(url: "https://github.com/Quick/Nimble", .upToNextMajor(from: "13.0.0")),
.package(url: "https://github.com/Quick/Quick", .upToNextMajor(from: "6.1.0")),
],
targets: [
Expand Down
8 changes: 4 additions & 4 deletions Sources/RxNimble/RxTest/Equal+RxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import RxSwift
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
public func equal<T: Equatable>(_ expectedEvents: RecordedEvents<T>) -> Matcher<RecordedEvents<T>> {
Matcher.define { actualEvents in
let actualEquatableEvents = try actualEvents.evaluate()?.map { AnyEquatable(target: $0, comparer: ==) }
let expectedEquatableEvents = expectedEvents.map { AnyEquatable(target: $0, comparer: ==) }

let matches = (actualEquatableEvents == expectedEquatableEvents)
return PredicateResult(bool: matches,
message: .expectedActualValueTo(
return MatcherResult(bool: matches,
message: .expectedActualValueTo(
"emit <\(stringify(expectedEquatableEvents))>")
)
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/RxNimble/RxTest/ThrowError+RxTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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>> {
public func throwError<T: Equatable>() -> Matcher<RecordedEvents<T>> {
func extractError(_ recorded: RecordedEvents<T>?) -> [Error]? {
func extractError<E>(_ recorded: Recorded<Event<E>>) -> Error? {
return recorded.value.error
Expand All @@ -18,7 +18,7 @@ public func throwError<T: Equatable>() -> Predicate<RecordedEvents<T>> {
}


return Predicate { actualEvents in
return Matcher { actualEvents in
var actualError: Error?
do {
let recordedEvents = try actualEvents.evaluate()
Expand All @@ -30,9 +30,9 @@ public func throwError<T: Equatable>() -> Predicate<RecordedEvents<T>> {
}

if let actualError = actualError {
return PredicateResult(bool: true, message: .expectedCustomValueTo("throw any error", actual: "<\(actualError)>"))
return MatcherResult(bool: true, message: .expectedCustomValueTo("throw any error", actual: "<\(actualError)>"))
} else {
return PredicateResult(bool: false, message: .expectedCustomValueTo("throw any error", actual: "no error"))
return MatcherResult(bool: false, message: .expectedCustomValueTo("throw any error", actual: "no error"))
}
}
}