diff options
Diffstat (limited to 'spec/models/merge_spec.rb')
| -rw-r--r-- | spec/models/merge_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/models/merge_spec.rb b/spec/models/merge_spec.rb index 8c3f48272..f1df40b83 100644 --- a/spec/models/merge_spec.rb +++ b/spec/models/merge_spec.rb @@ -30,6 +30,13 @@ RSpec.describe Merge do stop_areas = stop_area_referential.stop_areas.order("random()").limit(5) FactoryGirl.create :route, line: line, stop_areas: stop_areas, stop_points_count: 0 end + # Loop + stop_areas = stop_area_referential.stop_areas.order("random()").limit(5) + route = FactoryGirl.create :route, line: line, stop_areas: stop_areas, stop_points_count: 0 + route.stop_points.create stop_area: stop_areas.first, position: route.stop_points.size + jp = route.full_journey_pattern + expect(route.stop_points.uniq.count).to eq route.stop_areas.uniq.count + 1 + expect(jp.stop_points.uniq.count).to eq jp.stop_areas.uniq.count + 1 end referential.routes.each_with_index do |route, index| @@ -65,7 +72,7 @@ RSpec.describe Merge do end referential.journey_patterns.each do |journey_pattern| - stop_points_positions[journey_pattern.name] = Hash[*journey_pattern.stop_points.map{|sp| [sp.stop_area_id, sp.position]}.flatten] + stop_points_positions[journey_pattern.name] = Hash[*journey_pattern.stop_points.map{|sp| [sp.position, sp.stop_area_id]}.flatten] factor.times do FactoryGirl.create :vehicle_journey, journey_pattern: journey_pattern, company: company end @@ -118,7 +125,7 @@ RSpec.describe Merge do # This should be enforced by the checksum preservation though output.journey_patterns.each do |journey_pattern| journey_pattern.stop_points.each do |sp| - expect(sp.position).to eq stop_points_positions[journey_pattern.name][sp.stop_area_id] + expect(sp.stop_area_id).to eq stop_points_positions[journey_pattern.name][sp.position] end end |
