diff options
| author | Zog | 2018-01-10 16:39:08 +0100 |
|---|---|---|
| committer | Zog | 2018-01-10 16:56:53 +0100 |
| commit | 5c3abf69c50f00e0caab1517be2beccca10e635b (patch) | |
| tree | 1bc56181320dcad4b091ca6a57e5ef49153881fa /spec/support | |
| parent | 71614a19f62ed3f9ca3068e149dcd60471bef27d (diff) | |
| download | chouette-core-5c3abf69c50f00e0caab1517be2beccca10e635b.tar.bz2 | |
Refs #5535 @0.25h; Adds a `full_schedule?` on `JourneyPattern`
To know if all the costs between the stops of the pattern are set.
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/journey_pattern_helper.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/journey_pattern_helper.rb b/spec/support/journey_pattern_helper.rb new file mode 100644 index 000000000..d16120acf --- /dev/null +++ b/spec/support/journey_pattern_helper.rb @@ -0,0 +1,19 @@ +module Support + module JourneyPatternHelper + def generate_journey_pattern_costs distance, time + costs = {} + (journey_pattern.stop_points.size - 1).times do |i| + start, finish = journey_pattern.stop_points[i..i+1] + costs["#{start.id}-#{finish.id}"] = { + distance: (distance.respond_to?(:call) ? distance.call(i) : distance), + time: (time.respond_to?(:call) ? time.call(i) : time) + } + end + costs + end + end +end + +RSpec.configure do | config | + config.include Support::JourneyPatternHelper, type: :model +end |
