2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2016-06-16 23:09:34 +05:30
|
|
|
factory :deployment, class: Deployment do
|
|
|
|
sha '97de212e80737a608d939f648d959671fb0a0142'
|
|
|
|
ref 'master'
|
|
|
|
tag false
|
2018-03-17 18:26:18 +05:30
|
|
|
user nil
|
2016-09-29 09:46:39 +05:30
|
|
|
project nil
|
2017-08-17 22:00:37 +05:30
|
|
|
deployable factory: :ci_build
|
2016-06-16 23:09:34 +05:30
|
|
|
environment factory: :environment
|
|
|
|
|
|
|
|
after(:build) do |deployment, evaluator|
|
2016-09-29 09:46:39 +05:30
|
|
|
deployment.project ||= deployment.environment.project
|
2018-03-17 18:26:18 +05:30
|
|
|
deployment.user ||= deployment.project.creator
|
|
|
|
|
|
|
|
unless deployment.project.repository_exists?
|
|
|
|
allow(deployment.project.repository).to receive(:create_ref)
|
|
|
|
end
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|