aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-07-20 17:03:47 +0200
committerTeddy Wing2017-07-21 15:59:53 +0200
commit3ed55622c9ce5e700ce7dea992cd59d086ca51ea (patch)
treee109a99ad955c90e97fafce98bd35084b3c02174
parent5187bc61081a06949039730d0e991394bf62ccba (diff)
downloadchouette-core-3ed55622c9ce5e700ce7dea992cd59d086ca51ea.tar.bz2
VehicleJourneyAtStop spec: Move stubbed at-stop to `let`
Robert asked me to move the duplicated factory call to a `let` block to get rid of the duplication in the tests. Personally I'm not a huge fan of `let`s, but am following his recommendation here. Refs #3597
-rw-r--r--spec/models/chouette/vehicle_journey_at_stop_spec.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/spec/models/chouette/vehicle_journey_at_stop_spec.rb b/spec/models/chouette/vehicle_journey_at_stop_spec.rb
index 99c8af066..c4aef31b3 100644
--- a/spec/models/chouette/vehicle_journey_at_stop_spec.rb
+++ b/spec/models/chouette/vehicle_journey_at_stop_spec.rb
@@ -2,23 +2,19 @@ require 'spec_helper'
RSpec.describe Chouette::VehicleJourneyAtStop, type: :model do
describe "#day_offset_outside_range" do
- it "disallows negative offsets" do
- at_stop = build_stubbed(:vehicle_journey_at_stop)
+ let (:at_stop) { build_stubbed(:vehicle_journey_at_stop) }
+ it "disallows negative offsets" do
expect(at_stop.day_offset_outside_range?(-1)).to be true
end
it "disallows offsets greater than DAY_OFFSET_MAX" do
- at_stop = build_stubbed(:vehicle_journey_at_stop)
-
expect(at_stop.day_offset_outside_range?(
Chouette::VehicleJourneyAtStop::DAY_OFFSET_MAX + 1
)).to be true
end
it "allows offsets between 0 and DAY_OFFSET_MAX inclusive" do
- at_stop = build_stubbed(:vehicle_journey_at_stop)
-
expect(at_stop.day_offset_outside_range?(
Chouette::VehicleJourneyAtStop::DAY_OFFSET_MAX
)).to be false