diff options
| author | Teddy Wing | 2018-03-27 11:18:17 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-03-27 16:46:18 +0200 |
| commit | f257a8b3a7ae4c59c6907b41f6e8d7dc74259917 (patch) | |
| tree | 0178b9cd432c1c54b48fd25e9360c4d710972bf1 /spec/services | |
| parent | f03f942ecb9b802664dee0cc0f33f96a566c67e9 (diff) | |
| download | chouette-core-f257a8b3a7ae4c59c6907b41f6e8d7dc74259917.tar.bz2 | |
RouteWayCostCalculator: Use `TomTom.matrix` instead of batch
Calculate routes using the TomTom matrix API. Update the spec's HTTP
request stub accordingly (note that the stub is still fake).
Refs #6222
Diffstat (limited to 'spec/services')
| -rw-r--r-- | spec/services/route_way_cost_calculator_spec.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/services/route_way_cost_calculator_spec.rb b/spec/services/route_way_cost_calculator_spec.rb index d5358fcf6..79b81e34d 100644 --- a/spec/services/route_way_cost_calculator_spec.rb +++ b/spec/services/route_way_cost_calculator_spec.rb @@ -7,18 +7,20 @@ RSpec.describe RouteWayCostCalculator do # things in the request or response. This is just to fake the request so # we don't actually call their API in tests. The test doesn't test # anything given in the response. - stub_request(:post, "https://api.tomtom.com/routing/1/batch/json?key") + stub_request( + :post, + "https://api.tomtom.com/routing/1/matrix/json?key&routeType=shortest&travelMode=bus" + ) .with( headers: { 'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2' - } - ) + }) .to_return( status: 200, - body: "{\"formatVersion\":\"0.0.1\",\"batchItems\":[{\"statusCode\":200,\"response\":{\"routes\":[{\"summary\":{\"lengthInMeters\":117947,\"travelTimeInSeconds\":7969,\"trafficDelayInSeconds\":0,\"departureTime\":\"2018-03-12T12:32:26+01:00\",\"arrivalTime\":\"2018-03-12T14:45:14+01:00\"}}]}}]}", + body: "{\"formatVersion\":\"0.0.1\",\"matrix\":[[{\"statusCode\":200,\"response\":{\"routeSummary\":{\"lengthInMeters\":0,\"travelTimeInSeconds\":0,\"trafficDelayInSeconds\":0,\"departureTime\":\"2018-03-23T11:20:17+01:00\",\"arrivalTime\":\"2018-03-23T11:20:17+01:00\"}}}]]}", headers: {} ) |
