2017-12-13 19:13:44 -05:00
|
|
|
FactoryBot.define do
|
2016-06-14 07:51:12 -04:00
|
|
|
factory :deployment, class: Deployment do
|
|
|
|
sha '97de212e80737a608d939f648d959671fb0a0142'
|
|
|
|
ref 'master'
|
2016-06-15 06:03:49 -04:00
|
|
|
tag false
|
2017-08-04 13:14:04 -04:00
|
|
|
user nil
|
2016-09-20 00:24:42 -04:00
|
|
|
project nil
|
2016-11-09 03:42:09 -05:00
|
|
|
deployable factory: :ci_build
|
2016-06-14 07:51:12 -04:00
|
|
|
environment factory: :environment
|
|
|
|
|
|
|
|
after(:build) do |deployment, evaluator|
|
2016-09-20 00:24:42 -04:00
|
|
|
deployment.project ||= deployment.environment.project
|
2017-08-04 13:14:04 -04:00
|
|
|
deployment.user ||= deployment.project.creator
|
2017-08-09 09:41:45 -04:00
|
|
|
|
|
|
|
unless deployment.project.repository_exists?
|
2017-09-29 12:05:20 -04:00
|
|
|
allow(deployment.project.repository).to receive(:create_ref)
|
2017-08-09 09:41:45 -04:00
|
|
|
end
|
2016-06-14 07:51:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|