aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorAlban Peignier2018-06-01 11:39:35 +0200
committerGitHub2018-06-01 11:39:35 +0200
commit603c76257d7ff8dac1c3c8f852e1d7e43f2877cf (patch)
treeeaf2452d11108a408d11c2c38e79edf0b0f11031 /spec
parent12b974e13538b9f1952e4282c88d1b1a913c7f84 (diff)
parent979220d7f5b59f300c5617de2bf9c1791bf69b48 (diff)
downloadchouette-core-603c76257d7ff8dac1c3c8f852e1d7e43f2877cf.tar.bz2
Merge pull request #605 from af83/7260-fix-time-interpolation
Fix wrong day offset computation. Fixes #7260
Diffstat (limited to 'spec')
-rw-r--r--spec/models/chouette/vehicle_journey_spec.rb12
1 files changed, 12 insertions, 0 deletions
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