-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use beAnInstanceOf to match Expectations #38
Comments
Hmm! Sounds like you may have found a bug. We recently refactored the internals to support RxTest in #35, maybe this is a limitation we've hit? I'm not sure. The docs for Nimble's custom matchers are here: https://github.com/Quick/Nimble#writing-your-own-matchers Not sure about RxTest but I'd start in our Nimble implementation: https://github.com/RxSwiftCommunity/RxNimble/blob/master/Source/RxTest/Expectation%2BRxTest.swift A PR would be very welcome, thanks 🙇 |
Hey @SunDog thank you for reporting this. expect(subject).first resolves as let driverObject: Driver<Any> = Driver.just(Int())
// will compile
expect(driverObject.asObservable()).first.to(beAnInstanceOf(Int.self)) The only way to resolve this issue - fully rethink API of RxNimble. public extension ObservableConvertibleType {
var first: Element {
return try! self.toBlocking().first()! // dirty version with force unwrap
}
}
...
expect(o.first).to(beAnInstanceOf(Int.self)) // compiles If maintainers are ok with that, i will create PR @gobetti |
Hi @ashfurrow @MortyMerr ! |
@gobetti these declarations will conflict with |
When comparing instances or classes the methods
beAnInstanceOf
andbeAKindOf
returns aPredicate<Any>
but RxNimble expectation ask's forPredicate<T>
instead.Code:
I don't know if it is as expected or if we can improve this.
Therefore I'm at your disposal to make a PR for this, but I would need some direction since I think this is not as easy as just changing the type of
var first
The text was updated successfully, but these errors were encountered: