func testEmptyPriceEstimatesValidTimeEstimates()

in source/UberRidesTests/RequestButtonTests.swift [346:375]


    func testEmptyPriceEstimatesValidTimeEstimates() {
        stub(condition: isHost("sandbox-api.uber.com")) { urlRequest in
            if isPath("/v1.2/estimates/price")(urlRequest) {
                return HTTPStubsResponse(fileAtPath:OHPathForFile("getPriceEstimatesEmpty.json", type(of: self))!, statusCode:200, headers:nil)
            } else if isPath("/v1.2/estimates/time")(urlRequest) {
                return HTTPStubsResponse(fileAtPath:OHPathForFile("getTimeEstimateProduct.json", type(of: self))!, statusCode:200, headers:nil)
            } else {
                XCTAssert(false)
                return HTTPStubsResponse()
            }
        }

        expectation = expectation(description: "information loaded")
        let pickupLocation = CLLocation(latitude: pickupLat, longitude: pickupLong)
        let dropoffLocation = CLLocation(latitude: dropoffLat, longitude: dropoffLong)
        let builder = RideParametersBuilder()
        builder.pickupLocation = pickupLocation
        builder.dropoffLocation = dropoffLocation
        builder.productID = productID
        let rideParams = builder.build()
        button = RideRequestButton(client: client, rideParameters:rideParams, requestingBehavior: DeeplinkRequestingBehavior())
        button.delegate = self
        button.loadRideInformation()

        waitForExpectations(timeout: timeout, handler: { error in
            XCTAssertNil(error)
            XCTAssertEqual(self.button.uberTitleLabel.text!, "Get a ride")
            XCTAssertEqual(self.button.uberMetadataLabel.text!, "4 MINS AWAY")
        })
    }