aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTeddy Wing2017-05-24 12:10:56 +0200
committerRobert2017-05-29 08:49:52 +0200
commit49fda7e568f33add59086274b66349363cbf7d7d (patch)
treeb6cd9bbcb678ca6b6f95a6ad6b56edfe9b10637f /app
parent6dcca154825e12278849c8d3d1cacdbd8410c312 (diff)
downloadchouette-core-49fda7e568f33add59086274b66349363cbf7d7d.tar.bz2
IncreasingTimeOrderValidator: Move #increasing_times to #validate_each
Get rid of the `#increasing_times` method since it no longer made sense to me to keep it separate. We're not doing anything extra in `#validate_each`, the only place where it's called, so move the method's contents to `#validate_each`. Rename the `record` argument to `vehicle_journey` as I expect this validator to only be used on a `VehicleJourney`. Rename the `describe` in the specs because we're not actually calling `#increasing_times` in the spec. Refs #870
Diffstat (limited to 'app')
-rw-r--r--app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb b/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
index 1380e48b6..8e921b494 100644
--- a/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
+++ b/app/models/chouette/vehicle_journey_at_stops_are_in_increasing_time_order_validator.rb
@@ -1,11 +1,7 @@
module Chouette
class VehicleJourneyAtStopsAreInIncreasingTimeOrderValidator <
ActiveModel::EachValidator
- def validate_each(record, attribute, value)
- increasing_times(record)
- end
-
- def increasing_times(vehicle_journey)
+ def validate_each(vehicle_journey, attribute, value)
previous_at_stop = nil
vehicle_journey