aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorZog2018-03-05 12:00:29 +0100
committerZog2018-03-05 12:00:29 +0100
commita412f915c885f3bf2962d0b786ff864f1b0e120e (patch)
tree3352d379f3d5c963f4382c374c6e78eea33cb2e1 /spec
parentea3de6035cdf9fbbcd92f51c90e5a2c5c3400cb3 (diff)
downloadchouette-core-a412f915c885f3bf2962d0b786ff864f1b0e120e.tar.bz2
Refs #6068; Add some helpers in the models
Diffstat (limited to 'spec')
-rw-r--r--spec/models/chouette/journey_pattern_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb
index 7c767e4d1..dac45d6b5 100644
--- a/spec/models/chouette/journey_pattern_spec.rb
+++ b/spec/models/chouette/journey_pattern_spec.rb
@@ -71,6 +71,23 @@ describe Chouette::JourneyPattern, :type => :model do
end
end
+ describe "distance_to" do
+ let(:journey_pattern) { create :journey_pattern }
+ before do
+ journey_pattern.costs = generate_journey_pattern_costs(10, 10)
+ end
+ subject{ journey_pattern.distance_to stop}
+ context "for the first stop" do
+ let(:stop){ journey_pattern.stop_points.first }
+ it { should eq 0 }
+ end
+
+ context "for the last stop" do
+ let(:stop){ journey_pattern.stop_points.last }
+ it { should eq 40 }
+ end
+ end
+
describe "set_distances" do
let(:journey_pattern) { create :journey_pattern }
let(:distances){ [] }