 import CoreLocation
 import Quick
 import Nimble
+import ReactiveSwift
 @testable import Tropos
 
 final class GeocodeControllerSpec: QuickSpec {

                let controller = GeocodeController(geocoder: geocoder)
                let location = CLLocation(latitude: -1, longitude: -2)

                var error: Error?
                controller.reverseGeocodeLocation(location).subscribeError { error = $0 }

                expect(error).toEventually(matchError(CLError.self))
            }

            it("cancels the underlying geocode if the subscription is cancelled") {

                let location = CLLocation(latitude: 1, longitude: 2)

                var isComplete = false
                var error: CLError?
                var place: CLPlacemark?

                controller.reverseGeocode(location).start { event in
                    switch event {
                    case let .value(value):
                        place = value
                    case let .failed(err):
                        error = err
                    case .completed:
                        isComplete = true
                    case .interrupted:
                        break
                    }
                }

                expect(isComplete).toEventually(beTrue())
                expect(place?.location?.coordinate).to(equal(location.coordinate))
