diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/gitlab/ci/ansi2json | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) | |
download | gitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/gitlab/ci/ansi2json')
-rw-r--r-- | spec/lib/gitlab/ci/ansi2json/line_spec.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/lib/gitlab/ci/ansi2json/line_spec.rb b/spec/lib/gitlab/ci/ansi2json/line_spec.rb index d681447a0e8..909c0f1b3ea 100644 --- a/spec/lib/gitlab/ci/ansi2json/line_spec.rb +++ b/spec/lib/gitlab/ci/ansi2json/line_spec.rb @@ -76,10 +76,30 @@ RSpec.describe Gitlab::Ci::Ansi2json::Line do end describe '#set_section_duration' do - it 'sets and formats the section_duration' do - subject.set_section_duration(75) + shared_examples 'set_section_duration' do + it 'sets and formats the section_duration' do + subject.set_section_duration(75) - expect(subject.section_duration).to eq('01:15') + expect(subject.section_duration).to eq('01:15') + end + end + + context 'with default timezone' do + it_behaves_like 'set_section_duration' + end + + context 'with a timezone carrying minutes offset' do + before do + # The actual call by does use Time.at(...).utc that the following + # rubocop rule (Rails/TimeZone) suggests, but for this specific + # test's purposes we needed to mock at the Time.at call point. + + # rubocop:disable Rails/TimeZone + allow(Time).to receive(:at).with(75).and_return(Time.at(75, in: '+05:30')) + # rubocop:enable Rails/TimeZone + end + + it_behaves_like 'set_section_duration' end end |