From 979220d7f5b59f300c5617de2bf9c1791bf69b48 Mon Sep 17 00:00:00 2001 From: Zog Date: Fri, 1 Jun 2018 10:40:00 +0200 Subject: Refs #7260; Fix wrong day offset computation --- spec/models/chouette/vehicle_journey_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/models') diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb index 05560f9e3..5ab6378f9 100644 --- a/spec/models/chouette/vehicle_journey_spec.rb +++ b/spec/models/chouette/vehicle_journey_spec.rb @@ -983,6 +983,18 @@ describe Chouette::VehicleJourney, :type => :model do expect(@target_4.departure_time).to eq @target_3.arrival_time end + context "with a stop across midnight" do + before do + @middle.update arrival_time: @start.departure_time + 11.hours, departure_time: @start.departure_time + 13.hours, departure_day_offset: 1, arrival_day_offset: 0 + end + + it "should set the following stop day offset" do + @journey.reload.fill_passing_times! + expect(@target_3.reload.arrival_day_offset).to eq 1 + expect(@target_3.departure_day_offset).to eq 1 + end + end + context "with a day offset" do before do @end.update arrival_time: offset_passing_time(@middle.departure_time, - 4.hours), departure_time: offset_passing_time(@middle.departure_time, - 4.hours), departure_day_offset: 1, arrival_day_offset: 1 -- cgit v1.2.3