summaryrefslogtreecommitdiff
path: root/spec/factories/environments.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/environments.rb')
-rw-r--r--spec/factories/environments.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb
index 0852dda6b29..d8d699fb3aa 100644
--- a/spec/factories/environments.rb
+++ b/spec/factories/environments.rb
@@ -18,19 +18,30 @@ FactoryGirl.define do
# interconnected objects to simulate a review app.
#
after(:create) do |environment, evaluator|
+ pipeline = create(:ci_pipeline, project: environment.project)
+
+ deployable = create(:ci_build, name: "#{environment.name}:deploy",
+ pipeline: pipeline)
+
deployment = create(:deployment,
environment: environment,
project: environment.project,
+ deployable: deployable,
ref: evaluator.ref,
sha: environment.project.commit(evaluator.ref).id)
teardown_build = create(:ci_build, :manual,
- name: "#{deployment.environment.name}:teardown",
- pipeline: deployment.deployable.pipeline)
+ name: "#{environment.name}:teardown",
+ pipeline: pipeline)
deployment.update_column(:on_stop, teardown_build.name)
environment.update_attribute(:deployments, [deployment])
end
end
+
+ trait :non_playable do
+ status 'created'
+ self.when 'manual'
+ end
end
end