Fixes problem with required error.
This commit is contained in:
parent
300c44aced
commit
1c0475860a
|
|
@ -49,10 +49,10 @@ extension CLLocationManager {
|
|||
/**
|
||||
Reactive wrapper for `delegate` message.
|
||||
*/
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError> {
|
||||
public var rx_didFinishDeferredUpdatesWithError: Observable<NSError?> {
|
||||
return rx_delegate.observe("locationManager:didFinishDeferredUpdatesWithError:")
|
||||
.map { a in
|
||||
return try castOrThrow(NSError.self, a[1])
|
||||
return try castOptionalOrThrow(NSError.self, a[1])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -84,6 +84,26 @@ extension CLLocationManagerTests {
|
|||
XCTAssertTrue(completed)
|
||||
}
|
||||
|
||||
func testDidFinishDeferredUpdatesWithError_noError() {
|
||||
var completed = false
|
||||
var error: NSError?
|
||||
|
||||
autoreleasepool {
|
||||
let manager = CLLocationManager()
|
||||
|
||||
_ = manager.rx_didFinishDeferredUpdatesWithError.subscribe(onNext: { e in
|
||||
error = e
|
||||
}, onCompleted: {
|
||||
completed = true
|
||||
})
|
||||
|
||||
manager.delegate!.locationManager!(manager, didFinishDeferredUpdatesWithError: nil)
|
||||
}
|
||||
|
||||
XCTAssertEqual(error, nil)
|
||||
XCTAssertTrue(completed)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
|
|
|
|||
Loading…
Reference in New Issue