summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-03-23 03:54:49 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-04-06 23:46:58 +0900
commit5f715f1d32c6f5ce25b3721bde8f476173afadc8 (patch)
treeaae1982a02c2c53c0da9229154e45b6fecb01f61 /spec/factories
parent46e4ed6bd0c8c256bce6d35b4bb992d77fd09971 (diff)
downloadgitlab-ce-5f715f1d32c6f5ce25b3721bde8f476173afadc8.tar.gz
Add scheduled_trigger model. Add cron parser. Plus, specs.
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/ci/scheduled_triggers.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/factories/ci/scheduled_triggers.rb b/spec/factories/ci/scheduled_triggers.rb
new file mode 100644
index 00000000000..9d45f4b4962
--- /dev/null
+++ b/spec/factories/ci/scheduled_triggers.rb
@@ -0,0 +1,42 @@
+FactoryGirl.define do
+ factory :ci_scheduled_trigger, class: Ci::ScheduledTrigger do
+ project factory: :empty_project
+ owner factory: :user
+ ref 'master'
+
+ trait :cron_nightly_build do
+ cron '0 1 * * *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_weekly_build do
+ cron '0 1 * * 5'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_monthly_build do
+ cron '0 1 22 * *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_every_5_minutes do
+ cron '*/5 * * * *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_every_5_hours do
+ cron '* */5 * * *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_every_5_days do
+ cron '* * */5 * *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+
+ trait :cron_every_5_months do
+ cron '* * * */5 *'
+ cron_time_zone 'Europe/Istanbul'
+ end
+ end
+end