aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorTeddy Wing2018-03-26 11:49:40 +0200
committerTeddy Wing2018-03-27 16:46:18 +0200
commitddfc41f75cb52f02511e2acd6429270bc9c0ab19 (patch)
tree0f0d35ee3c258eb42e8a8526efe4ea42e184bf4c /spec/lib
parent0a45ba811eefebb97bdc75f5e70da2be13186c28 (diff)
downloadchouette-core-ddfc41f75cb52f02511e2acd6429270bc9c0ab19.tar.bz2
TomTom::Matrix#extract_costs_to_way_costs!: Try to include stop IDs
Change this code to get stop IDs based on the change in be3e1effcdea87909a181c7e9b12cf6867b1839d. It should use these IDs to construct new `WayCost`s with the combination of stop IDs from departure and arrival stops. This doesn't work currently because the method has code that tries to index the `points` collection, but it's a `Set`, and sets don't support indexing and aren't ordered, so this code errors. Need to change the `Set` to something else that will work here. Refs #6222
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/tom_tom/matrix_spec.rb29
1 files changed, 19 insertions, 10 deletions
diff --git a/spec/lib/tom_tom/matrix_spec.rb b/spec/lib/tom_tom/matrix_spec.rb
index b27d99a64..e67e539b7 100644
--- a/spec/lib/tom_tom/matrix_spec.rb
+++ b/spec/lib/tom_tom/matrix_spec.rb
@@ -82,11 +82,13 @@ RSpec.describe TomTom::Matrix do
way_costs = [
WayCost.new(
departure: Geokit::LatLng.new(48.85086, 2.36143),
- arrival: Geokit::LatLng.new(47.91231, 1.87606)
+ arrival: Geokit::LatLng.new(47.91231, 1.87606),
+ id: '55-99'
),
WayCost.new(
departure: Geokit::LatLng.new(47.91231, 1.87606),
- arrival: Geokit::LatLng.new(52.50867, 13.42879)
+ arrival: Geokit::LatLng.new(52.50867, 13.42879),
+ id: '99-22'
)
]
@@ -95,49 +97,56 @@ RSpec.describe TomTom::Matrix do
departure: Geokit::LatLng.new(48.85086, 2.36143),
arrival: Geokit::LatLng.new(47.91231, 1.87606),
distance: 117947,
- time: 8356
+ time: 8356,
+ id: '55-99'
),
WayCost.new(
departure: Geokit::LatLng.new(48.85086, 2.36143),
arrival: Geokit::LatLng.new(52.50867, 13.42879),
distance: 999088,
- time: 62653
+ time: 62653,
+ id: '55-22'
),
WayCost.new(
departure: Geokit::LatLng.new(47.91231, 1.87606),
arrival: Geokit::LatLng.new(48.85086, 2.36143),
distance: 117231,
- time: 9729
+ time: 9729,
+ id: '99-55'
),
WayCost.new(
departure: Geokit::LatLng.new(47.91231, 1.87606),
arrival: Geokit::LatLng.new(52.50867, 13.42879),
distance: 1114635,
- time: 72079
+ time: 72079,
+ id: '99-22'
),
WayCost.new(
departure: Geokit::LatLng.new(52.50867, 13.42879),
arrival: Geokit::LatLng.new(48.85086, 2.36143),
distance: 997232,
- time: 63245
+ time: 63245,
+ id: '22-55'
),
WayCost.new(
departure: Geokit::LatLng.new(52.50867, 13.42879),
arrival: Geokit::LatLng.new(47.91231, 1.87606),
distance: 1113108,
- time: 68485
+ time: 68485,
+ id: '22-99'
),
WayCost.new(
departure: Geokit::LatLng.new(52.50867, 13.42879),
arrival: Geokit::LatLng.new(52.50867, 13.42879),
distance: 344,
- time: 109
+ time: 109,
+ id: '22-22'
)
]
matrix_response = JSON.parse(read_fixture('tom_tom_matrix.json'))
- points = matrix.points_as_params(matrix.points_from_way_costs(way_costs))
+ points = matrix.points_from_way_costs(way_costs)
expect(
matrix.extract_costs_to_way_costs!(way_costs, points, matrix_response)