diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-12 18:07:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-12 18:07:13 +0000 |
commit | ba5be4989e02566ad45191b6d97815e189a26dac (patch) | |
tree | 96a4ace3c3d61ec4aea31cbf548718ef67cfd84b /spec/lib/gitlab/ci/cron_parser_spec.rb | |
parent | 22a3da26ad21d67acaef7b2598429c8a003f1037 (diff) | |
download | gitlab-ce-ba5be4989e02566ad45191b6d97815e189a26dac.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/cron_parser_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/cron_parser_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/cron_parser_spec.rb b/spec/lib/gitlab/ci/cron_parser_spec.rb index 33474865a93..4b750cf3bcf 100644 --- a/spec/lib/gitlab/ci/cron_parser_spec.rb +++ b/spec/lib/gitlab/ci/cron_parser_spec.rb @@ -358,4 +358,22 @@ RSpec.describe Gitlab::Ci::CronParser do end end end + + describe '#match?' do + let(:run_date) { Time.zone.local(2021, 3, 2, 1, 0) } + + subject(:matched) { described_class.new(cron, Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE).match?(run_date) } + + context 'when cron matches up' do + let(:cron) { '0 1 2 3 *' } + + it { is_expected.to eq(true) } + end + + context 'when cron does not match' do + let(:cron) { '5 4 3 2 1' } + + it { is_expected.to eq(false) } + end + end end |