diff options
| author | Alban Peignier | 2018-05-17 12:38:50 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-17 16:27:32 +0200 |
| commit | 85864e22795e6a2f04032234e2e39a58e900f1a5 (patch) | |
| tree | 4287a7af0ccef07bbda6da008a1a6a5ea7211163 | |
| parent | e0864d754a0467addb39ce860b659818877bb9ec (diff) | |
| download | chouette-core-85864e22795e6a2f04032234e2e39a58e900f1a5.tar.bz2 | |
Test opposite routes in merge referential. Refs #6842
| -rw-r--r-- | app/models/merge.rb | 2 | ||||
| -rw-r--r-- | spec/models/merge_spec.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/app/models/merge.rb b/app/models/merge.rb index c8018e140..aca2f4d4d 100644 --- a/app/models/merge.rb +++ b/app/models/merge.rb @@ -166,7 +166,7 @@ class Merge < ApplicationModel objectid: objectid, # line_id is the same # all other primary must be changed - opposite_route_id: nil #FIXME + opposite_route_id: nil # merged after ) new_route = new.routes.build attributes diff --git a/spec/models/merge_spec.rb b/spec/models/merge_spec.rb index 34df0fb4e..8c3f48272 100644 --- a/spec/models/merge_spec.rb +++ b/spec/models/merge_spec.rb @@ -92,12 +92,14 @@ RSpec.describe Merge do output.routes.each do |route| stop_points = nil old_route = nil + old_opposite_route = nil referential.switch do old_route = Chouette::Route.find_by(checksum: route.checksum) stop_points = {} old_route.routing_constraint_zones.each do |constraint_zone| stop_points[constraint_zone.checksum] = constraint_zone.stop_points.map(&:registration_number) end + old_opposite_route = old_route.opposite_route end routing_constraint_zones[old_route.id].each do |checksum, constraint_zone| new_constraint_zone = route.routing_constraint_zones.where(checksum: checksum).last @@ -108,6 +110,8 @@ RSpec.describe Merge do route.vehicle_journeys.each do |vehicle_journey| expect(vehicle_journey.ignored_routing_contraint_zones.size).to eq vehicle_journey.ignored_routing_contraint_zone_ids.size end + + expect(route.opposite_route&.checksum).to eq(old_opposite_route&.checksum) end # Let's check stop_point positions are respected |
