summaryrefslogtreecommitdiff
path: root/spec/factories/ci
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/ci')
-rw-r--r--spec/factories/ci/builds.rb20
-rw-r--r--spec/factories/ci/pipeline_schedule.rb29
-rw-r--r--spec/factories/ci/pipelines.rb4
-rw-r--r--spec/factories/ci/runners.rb4
-rw-r--r--spec/factories/ci/triggers.rb9
-rw-r--r--spec/factories/ci/variables.rb2
6 files changed, 63 insertions, 5 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index f78086211f7..78ddd8d5584 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -79,6 +79,19 @@ FactoryGirl.define do
manual
end
+ trait :retryable do
+ success
+ end
+
+ trait :cancelable do
+ pending
+ end
+
+ trait :erasable do
+ success
+ artifacts
+ end
+
trait :tags do
tag_list [:docker, :ruby]
end
@@ -111,7 +124,7 @@ FactoryGirl.define do
trait :trace do
after(:create) do |build, evaluator|
- build.trace = 'BUILD TRACE'
+ build.trace.set('BUILD TRACE')
end
end
@@ -192,5 +205,10 @@ FactoryGirl.define do
trait :no_options do
options { {} }
end
+
+ trait :non_playable do
+ status 'created'
+ self.when 'manual'
+ end
end
end
diff --git a/spec/factories/ci/pipeline_schedule.rb b/spec/factories/ci/pipeline_schedule.rb
new file mode 100644
index 00000000000..a716da46ac6
--- /dev/null
+++ b/spec/factories/ci/pipeline_schedule.rb
@@ -0,0 +1,29 @@
+FactoryGirl.define do
+ factory :ci_pipeline_schedule, class: Ci::PipelineSchedule do
+ cron '0 1 * * *'
+ cron_timezone Gitlab::Ci::CronParser::VALID_SYNTAX_SAMPLE_TIME_ZONE
+ ref 'master'
+ active true
+ description "pipeline schedule"
+ project factory: :empty_project
+
+ 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
+
+ trait :inactive do
+ active false
+ end
+ end
+end
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb
index b67c96bc00d..561fbc8e247 100644
--- a/spec/factories/ci/pipelines.rb
+++ b/spec/factories/ci/pipelines.rb
@@ -48,6 +48,10 @@ FactoryGirl.define do
trait :success do
status :success
end
+
+ trait :failed do
+ status :failed
+ end
end
end
end
diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb
index c3b4aff55ba..05abf60d5ce 100644
--- a/spec/factories/ci/runners.rb
+++ b/spec/factories/ci/runners.rb
@@ -1,8 +1,6 @@
FactoryGirl.define do
factory :ci_runner, class: Ci::Runner do
- sequence :description do |n|
- "My runner#{n}"
- end
+ sequence(:description) { |n| "My runner#{n}" }
platform "darwin"
is_shared false
diff --git a/spec/factories/ci/triggers.rb b/spec/factories/ci/triggers.rb
index a27b04424e5..c3a29d8bf04 100644
--- a/spec/factories/ci/triggers.rb
+++ b/spec/factories/ci/triggers.rb
@@ -1,7 +1,14 @@
FactoryGirl.define do
factory :ci_trigger_without_token, class: Ci::Trigger do
factory :ci_trigger do
- token 'token'
+ sequence(:token) { |n| "token#{n}" }
+
+ factory :ci_trigger_for_trigger_schedule do
+ token { SecureRandom.hex(15) }
+ owner factory: :user
+ project factory: :project
+ ref 'master'
+ end
end
end
end
diff --git a/spec/factories/ci/variables.rb b/spec/factories/ci/variables.rb
index 6653f0bb5c3..c5fba597c1c 100644
--- a/spec/factories/ci/variables.rb
+++ b/spec/factories/ci/variables.rb
@@ -2,5 +2,7 @@ FactoryGirl.define do
factory :ci_variable, class: Ci::Variable do
sequence(:key) { |n| "VARIABLE_#{n}" }
value 'VARIABLE_VALUE'
+
+ project factory: :empty_project
end
end