summaryrefslogtreecommitdiff
path: root/spec/factories
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-05-06 17:17:02 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-05-06 17:17:02 +0000
commit6ad3814e1b31bfacfae7a2aabb4e4607b12ca66f (patch)
treeb6024ca475dea081d9f38e4b14a2709d17af3a50 /spec/factories
parent2e6201b13197d03eafecd18d967ba7d55f664e19 (diff)
parentfc121cca5ba87abd24afbc8da2f76e14e386e4c8 (diff)
downloadgitlab-ce-6ad3814e1b31bfacfae7a2aabb4e4607b12ca66f.tar.gz
Merge branch 'feature/gb/manual-actions-protected-branches-permissions' into 'master'
Check access to a branch when user triggers manual action Closes #20261 See merge request !10494
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/environments.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/factories/environments.rb b/spec/factories/environments.rb
index 3fbf24b5c7d..d8d699fb3aa 100644
--- a/spec/factories/environments.rb
+++ b/spec/factories/environments.rb
@@ -18,15 +18,21 @@ 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])