aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorXinhui2017-04-12 12:36:22 +0200
committerXinhui2017-04-12 12:36:32 +0200
commitd7c6d5ce602219b9bfa47686542dd575f1fe2e50 (patch)
treeb418dd68f2a796b172fda0d90f960606f9fb8865 /spec
parent0ee6e6c7a85fa72d325ad32d8aa33583919692fd (diff)
downloadchouette-core-d7c6d5ce602219b9bfa47686542dd575f1fe2e50.tar.bz2
Remove auto create vjas on jv create if all departure time is set to 00:00
Refs #3101
Diffstat (limited to 'spec')
-rw-r--r--spec/models/chouette/vehicle_journey_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb
index c922731a7..8349199d2 100644
--- a/spec/models/chouette/vehicle_journey_spec.rb
+++ b/spec/models/chouette/vehicle_journey_spec.rb
@@ -59,6 +59,21 @@ describe Chouette::VehicleJourney, :type => :model do
}.to change {Chouette::VehicleJourneyAtStop.count}.by(1)
end
+ it 'should note save vehicle_journey_at_stops of newly created vj if all departure time is set to 00:00' do
+ new_vj = build(:vehicle_journey, objectid: nil, published_journey_name: 'dummy', route: route, journey_pattern: journey_pattern)
+ 2.times do
+ new_vj.vehicle_journey_at_stops << build(:vehicle_journey_at_stop,
+ :vehicle_journey => new_vj,
+ :stop_point => create(:stop_point),
+ :arrival_time => '2000-01-01 00:00:00 UTC',
+ :departure_time => '2000-01-01 00:00:00 UTC')
+ end
+ collection << vehicle_journey_to_state(new_vj)
+ expect {
+ Chouette::VehicleJourney.state_update(route, collection)
+ }.not_to change {Chouette::VehicleJourneyAtStop.count}
+ end
+
it 'should update vj journey_pattern' do
state['journey_pattern'] = create(:journey_pattern).attributes.slice('id', 'name', 'objectid')
Chouette::VehicleJourney.state_update(route, collection)