summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-04-06 18:55:34 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-04-06 18:55:34 +0000
commit1815d44a7ffd86f8eefd42ae0eac59a6ade66e7f (patch)
tree6b61d8de4b0d6ff912b5ed6343922758447330e9 /spec/factories
parentbef1aca8837f2306ecbd8ff70deb2204bf1da539 (diff)
parent9441c01484e668892d06f387fc0f85fe2d4ff4b4 (diff)
downloadgitlab-ce-1815d44a7ffd86f8eefd42ae0eac59a6ade66e7f.tar.gz
Merge branch '2989-run-cicd-pipelines-on-a-schedule-idea1-basic-backend-implementation' into 'master'
Resolve "Run CI/CD pipelines on a schedule" - "Basic backend implementation" See merge request !10133
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/ci/trigger_schedules.rb26
-rw-r--r--spec/factories/ci/triggers.rb7
2 files changed, 33 insertions, 0 deletions
diff --git a/spec/factories/ci/trigger_schedules.rb b/spec/factories/ci/trigger_schedules.rb
new file mode 100644
index 00000000000..315bce16995
--- /dev/null
+++ b/spec/factories/ci/trigger_schedules.rb
@@ -0,0 +1,26 @@
+FactoryGirl.define do
+ factory :ci_trigger_schedule, class: Ci::TriggerSchedule do
+ trigger factory: :ci_trigger_for_trigger_schedule
+ cron '0 1 * * *'
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+
+ after(:build) do |trigger_schedule, evaluator|
+ trigger_schedule.update!(project: trigger_schedule.trigger.project)
+ end
+
+ trait :nightly do
+ cron '0 1 * * *'
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ end
+
+ trait :weekly do
+ cron '0 1 * * 6'
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ end
+
+ trait :monthly do
+ cron '0 1 22 * *'
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ end
+ end
+end
diff --git a/spec/factories/ci/triggers.rb b/spec/factories/ci/triggers.rb
index a27b04424e5..2295455575d 100644
--- a/spec/factories/ci/triggers.rb
+++ b/spec/factories/ci/triggers.rb
@@ -2,6 +2,13 @@ FactoryGirl.define do
factory :ci_trigger_without_token, class: Ci::Trigger do
factory :ci_trigger do
token 'token'
+
+ factory :ci_trigger_for_trigger_schedule do
+ token { SecureRandom.hex(15) }
+ owner factory: :user
+ project factory: :project
+ ref 'master'
+ end
end
end
end