Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-11-27 19:53:16 +0300
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-12-19 12:58:53 +0300
commit9f9765485e998ece87660aa30a1b4339bb940d14 (patch)
tree0615fe12d0780847dee1c0dca8c0f0d59674048f /spec/serializers/entity_date_helper_spec.rb
parent6c79e9307e116d6115f6d76ac796176952fb83cd (diff)
Refactor sidebar to use data from serializer
Diffstat (limited to 'spec/serializers/entity_date_helper_spec.rb')
-rw-r--r--spec/serializers/entity_date_helper_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/serializers/entity_date_helper_spec.rb b/spec/serializers/entity_date_helper_spec.rb
index 36da8d33a44..df7f33847c9 100644
--- a/spec/serializers/entity_date_helper_spec.rb
+++ b/spec/serializers/entity_date_helper_spec.rb
@@ -96,5 +96,31 @@ describe EntityDateHelper do
expect(milestone_remaining).to eq("<strong>2</strong> days elapsed")
end
end
+
+ context 'with Hash as param' do
+ context 'when due_date is in the past' do
+ it 'returns "Past due"' do
+ expect(date_helper_class.remaining_days_in_words(due_date: 2.days.ago.to_date)).to eq("<strong>Past due</strong>")
+ end
+ end
+
+ context 'when due_date is in the future' do
+ it 'returns days remaining' do
+ expect(date_helper_class.remaining_days_in_words(due_date: 12.days.from_now.to_date)).to eq("<strong>12</strong> days remaining")
+ end
+ end
+
+ context 'when start_date is in the future' do
+ it 'returns "Upcoming"' do
+ expect(date_helper_class.remaining_days_in_words(start_date: 2.days.from_now.to_date)).to eq("<strong>Upcoming</strong>")
+ end
+ end
+
+ context 'when start_date is in the past' do
+ it 'returns days elapsed' do
+ expect(date_helper_class.remaining_days_in_words(start_date: 2.days.ago.to_date)).to eq("<strong>2</strong> days elapsed")
+ end
+ end
+ end
end
end