aboutsummaryrefslogtreecommitdiffstats
path: root/spec/decorators
diff options
context:
space:
mode:
authorAlban Peignier2017-12-20 20:52:58 +0100
committerAlban Peignier2017-12-20 22:24:46 +0100
commitffa7c137f0d06f37f67561f09472b304efa90069 (patch)
treeaabf81f1bf792b58641ed1a126b9204e26709630 /spec/decorators
parentb012deb3ec8626d2d114dd725cfaeed363e08e25 (diff)
downloadchouette-core-ffa7c137f0d06f37f67561f09472b304efa90069.tar.bz2
Add StopArea#waiting_time with support in stop_areas#index/show. Refs #5351
Diffstat (limited to 'spec/decorators')
-rw-r--r--spec/decorators/referential_decorator_spec.rb1
-rw-r--r--spec/decorators/stop_area_decorator_spec.rb25
2 files changed, 26 insertions, 0 deletions
diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb
index cbeaf2407..879ab7d4b 100644
--- a/spec/decorators/referential_decorator_spec.rb
+++ b/spec/decorators/referential_decorator_spec.rb
@@ -1,4 +1,5 @@
RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do
+ include Support::DecoratorHelpers
let( :object ){ build_stubbed :referential }
let( :referential ){ object }
diff --git a/spec/decorators/stop_area_decorator_spec.rb b/spec/decorators/stop_area_decorator_spec.rb
new file mode 100644
index 000000000..fd6aa207a
--- /dev/null
+++ b/spec/decorators/stop_area_decorator_spec.rb
@@ -0,0 +1,25 @@
+require "rails_helper"
+
+RSpec.describe StopAreaDecorator do
+
+ let(:stop_area) { Chouette::StopArea.new }
+ let(:decorator) { stop_area.decorate }
+
+ describe '#waiting_time_text' do
+ it "returns '-' when waiting_time is nil" do
+ stop_area.waiting_time = nil
+ expect(decorator.waiting_time_text).to eq('-')
+ end
+
+ it "returns '-' when waiting_time is zero" do
+ stop_area.waiting_time = 0
+ expect(decorator.waiting_time_text).to eq('-')
+ end
+
+ it "returns '120 minutes' when waiting_time is 120" do
+ stop_area.waiting_time = 120
+ expect(decorator.waiting_time_text).to eq('120 minutes')
+ end
+ end
+
+end