Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-04-06 23:00:00 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2017-04-06 23:05:22 +0300
commit37a7b099d6eafc87209368a9fc7f608282b99e08 (patch)
treea2712e439cec8547d84bed2d57d339cb1cd5c502 /spec/factories
parent57c353fca7121a120142161b253004f33d815766 (diff)
parent73cb71e41c0ade92b9673a5d74c7dd78679fae91 (diff)
Merge remote-tracking branch 'origin/master' into optimise-pipelines
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/ci/builds.rb7
-rw-r--r--spec/factories/ci/trigger_schedules.rb26
-rw-r--r--spec/factories/ci/triggers.rb7
-rw-r--r--spec/factories/container_repositories.rb33
-rw-r--r--spec/factories/environments.rb5
-rw-r--r--spec/factories/keys.rb4
6 files changed, 81 insertions, 1 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index f78086211f7..b62def83ee4 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -111,7 +111,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 +192,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/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 40c4663c6d8..c3a29d8bf04 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
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/container_repositories.rb b/spec/factories/container_repositories.rb
new file mode 100644
index 00000000000..3fcad9fd4b3
--- /dev/null
+++ b/spec/factories/container_repositories.rb
@@ -0,0 +1,33 @@
+FactoryGirl.define do
+ factory :container_repository do
+ name 'test_container_image'
+ project
+
+ transient do
+ tags []
+ end
+
+ trait :root do
+ name ''
+ end
+
+ after(:build) do |repository, evaluator|
+ next if evaluator.tags.to_a.none?
+
+ allow(repository.client)
+ .to receive(:repository_tags)
+ .and_return({
+ 'name' => repository.path,
+ 'tags' => evaluator.tags
+ })
+
+ evaluator.tags.each do |tag|
+ allow(repository.client)
+ .to receive(:repository_tag_digest)
+ .with(repository.path, tag)
+ .and_return('sha256:4c8e63ca4cb663ce6c688cb06f1c3' \
+ '72b088dac5b6d7ad7d49cd620d85cf72a15')
+ end
+ end
+ end
+end
diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb
index 0852dda6b29..3fbf24b5c7d 100644
--- a/spec/factories/environments.rb
+++ b/spec/factories/environments.rb
@@ -32,5 +32,10 @@ FactoryGirl.define do
environment.update_attribute(:deployments, [deployment])
end
end
+
+ trait :non_playable do
+ status 'created'
+ self.when 'manual'
+ end
end
end
diff --git a/spec/factories/keys.rb b/spec/factories/keys.rb
index dd93b439b2b..4e140102492 100644
--- a/spec/factories/keys.rb
+++ b/spec/factories/keys.rb
@@ -23,5 +23,9 @@ FactoryGirl.define do
factory :another_deploy_key, class: 'DeployKey' do
end
end
+
+ factory :write_access_key, class: 'DeployKey' do
+ can_push true
+ end
end
end