diff options
| author | Alban Peignier | 2018-05-17 12:23:51 +0200 |
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-17 16:27:32 +0200 |
| commit | e0864d754a0467addb39ce860b659818877bb9ec (patch) | |
| tree | 89cfc91fb0bf34630cd88f7aee28263cbe41885c /spec | |
| parent | 488237c48b6174873470d7b6ce3d1465df46ba20 (diff) | |
| download | chouette-core-e0864d754a0467addb39ce860b659818877bb9ec.tar.bz2 | |
Associate opposite_routes during merge (when available). Refs #6842
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/models/merge_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/models/merge_spec.rb b/spec/models/merge_spec.rb index 59e2cc500..34df0fb4e 100644 --- a/spec/models/merge_spec.rb +++ b/spec/models/merge_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Merge do line_referential = FactoryGirl.create :line_referential company = FactoryGirl.create :company, line_referential: line_referential - 10.times { FactoryGirl.create :line, line_referential: line_referential, company: company, network: nil } + 4.times { FactoryGirl.create :line, line_referential: line_referential, company: company, network: nil } workbench = FactoryGirl.create :workbench, line_referential: line_referential, stop_area_referential: stop_area_referential @@ -19,7 +19,7 @@ RSpec.describe Merge do organisation: workbench.organisation, metadatas: [referential_metadata] - factor = 1 + factor = 2 stop_points_positions = {} routing_constraint_zones = {} @@ -32,7 +32,7 @@ RSpec.describe Merge do end end - referential.routes.each do |route| + referential.routes.each_with_index do |route, index| route.stop_points.each do |sp| sp.set_list_position 0 end @@ -47,9 +47,18 @@ RSpec.describe Merge do routing_constraint_zones[route.id][constraint_zone.checksum] = constraint_zone end - route.reload.update_checksum! + if index.even? + route.wayback = :outbound + else + route.update_column :wayback, :inbound + route.opposite_route = route.opposite_route_candidates.sample + end + + route.save! + route.reload.update_checksum! expect(route.reload.checksum).to_not eq checksum + factor.times do FactoryGirl.create :journey_pattern, route: route, stop_points: route.stop_points.sample(3) end |
