diff options
author | Rémy Coutable <remy@rymai.me> | 2017-11-06 08:08:18 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-11-06 08:08:18 +0000 |
commit | ff996108a7c574080a2241ea0cfc4f4b3372cf35 (patch) | |
tree | 0a803213340b477d5582a6bc0e6b4426d20062e7 | |
parent | 1d5f2f9c333534b7004501bcfa52ca873d6a3403 (diff) | |
parent | 19a90fe44ea6f403461b15ebfe379bf6b0419990 (diff) | |
download | gitlab-ce-ff996108a7c574080a2241ea0cfc4f4b3372cf35.tar.gz |
Merge branch 'fix/sm/39817-fix-cron_parser_spec-rb' into 'master'
Fix cron_parser_spec.rb (`master` branch failure on Nov 5th)
Closes #39817
See merge request gitlab-org/gitlab-ce!15196
-rw-r--r-- | spec/lib/gitlab/ci/cron_parser_spec.rb | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/spec/lib/gitlab/ci/cron_parser_spec.rb b/spec/lib/gitlab/ci/cron_parser_spec.rb index 809fda11879..2a3f7807fdb 100644 --- a/spec/lib/gitlab/ci/cron_parser_spec.rb +++ b/spec/lib/gitlab/ci/cron_parser_spec.rb @@ -77,8 +77,20 @@ describe Gitlab::Ci::CronParser do it_behaves_like "returns time in the future" - it 'converts time in server time zone' do - expect(subject.hour).to eq(hour_in_utc) + context 'when PST (Pacific Standard Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 1, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end + end + + context 'when PDT (Pacific Daylight Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 6, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end end end end @@ -100,8 +112,20 @@ describe Gitlab::Ci::CronParser do it_behaves_like "returns time in the future" - it 'converts time in server time zone' do - expect(subject.hour).to eq(hour_in_utc) + context 'when CET (Central European Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 1, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end + end + + context 'when CEST (Central European Summer Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 6, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end end end @@ -111,8 +135,20 @@ describe Gitlab::Ci::CronParser do it_behaves_like "returns time in the future" - it 'converts time in server time zone' do - expect(subject.hour).to eq(hour_in_utc) + context 'when EST (Eastern Standard Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 1, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end + end + + context 'when EDT (Eastern Daylight Time)' do + it 'converts time in server time zone' do + Timecop.freeze(Time.utc(2017, 6, 1)) do + expect(subject.hour).to eq(hour_in_utc) + end + end end end end |