diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 00:11:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 00:11:21 +0300 |
commit | 09fd08f7e5db4514ce82223ab9a28ed8f823fb17 (patch) | |
tree | 764e4805ad6874358f26426c1e66611e0b377a87 /spec/lib/gitlab/time_tracking_formatter_spec.rb | |
parent | 33998a0e768263828f497685ae030f585193317f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/time_tracking_formatter_spec.rb')
-rw-r--r-- | spec/lib/gitlab/time_tracking_formatter_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/gitlab/time_tracking_formatter_spec.rb b/spec/lib/gitlab/time_tracking_formatter_spec.rb index ab0611e6b6a..4203a76cbfb 100644 --- a/spec/lib/gitlab/time_tracking_formatter_spec.rb +++ b/spec/lib/gitlab/time_tracking_formatter_spec.rb @@ -4,7 +4,9 @@ require 'spec_helper' RSpec.describe Gitlab::TimeTrackingFormatter do describe '#parse' do - subject { described_class.parse(duration_string) } + let(:keep_zero) { false } + + subject { described_class.parse(duration_string, keep_zero: keep_zero) } context 'positive durations' do let(:duration_string) { '3h 20m' } @@ -25,6 +27,24 @@ RSpec.describe Gitlab::TimeTrackingFormatter do expect(subject).to eq(576_000) end end + + context 'when the duration is zero' do + let(:duration_string) { '0h' } + + context 'when keep_zero is false' do + it 'returns nil' do + expect(subject).to be_nil + end + end + + context 'when keep_zero is true' do + let(:keep_zero) { true } + + it 'returns zero' do + expect(subject).to eq(0) + end + end + end end describe '#output' do |