diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-08-22 14:29:40 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-09-03 15:19:58 +0300 |
commit | 8e6e1e1d155c39a770600ccaf51b9c617463fd19 (patch) | |
tree | 230c40eb4c3785edde6715f59e18f71595a1ec68 /spec | |
parent | da0a5c7cc20194b71c41bd5572717fd9ac382cf4 (diff) | |
download | gitlab-ce-8e6e1e1d155c39a770600ccaf51b9c617463fd19.tar.gz |
Fix wording on milestone due date today62591-fix-milestone-due-date-today-wording
Fix wording on milestone due date, to show today instead of
hours ago or remaining, when milestone is due today.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/serializers/entity_date_helper_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/serializers/entity_date_helper_spec.rb b/spec/serializers/entity_date_helper_spec.rb index ae0f917415c..73506954965 100644 --- a/spec/serializers/entity_date_helper_spec.rb +++ b/spec/serializers/entity_date_helper_spec.rb @@ -57,6 +57,28 @@ describe EntityDateHelper do end end + context 'when milestone due date is today' do + let(:milestone_remaining) { date_helper_class.remaining_days_in_words(Date.today) } + + it 'returns today' do + expect(milestone_remaining).to eq("<strong>Today</strong>") + end + end + + context 'when milestone due date is tomorrow' do + let(:milestone_remaining) { date_helper_class.remaining_days_in_words(Date.tomorrow) } + + it 'returns 1 day remaining' do + expect(milestone_remaining).to eq("<strong>1</strong> day remaining") + end + + it 'returns 1 day remaining when queried mid-day' do + Timecop.freeze(Time.utc(2017, 3, 17, 13, 10)) do + expect(milestone_remaining).to eq("<strong>1</strong> day remaining") + end + end + end + context 'when less than 1 year and more than 30 days remaining' do let(:milestone_remaining) { date_helper_class.remaining_days_in_words(2.months.from_now.utc.to_date) } |