BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ceb06983
Commit
ceb06983
authored
Nov 14, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to fabricate environment on branch
parent
990765ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
environments.rb
spec/factories/environments.rb
+7
-2
stop_environments_service_spec.rb
spec/services/ci/stop_environments_service_spec.rb
+13
-4
No files found.
spec/factories/environments.rb
View file @
ceb06983
...
...
@@ -8,16 +8,21 @@ FactoryGirl.define do
trait
:with_review_app
do
|
environment
|
project
transient
do
ref
'master'
end
# At this point `review app` is an ephemeral concept related to
# deployments being deployed for given environment. There is no
# first-class `review app` available so we need to create set of
# interconnected objects to simulate a review app.
#
after
(
:create
)
do
|
environment
|
after
(
:create
)
do
|
environment
,
evaluator
|
deployment
=
create
(
:deployment
,
environment:
environment
,
project:
environment
.
project
,
sha:
environment
.
project
.
commit
.
id
)
ref:
evaluator
.
ref
,
sha:
environment
.
project
.
commit
(
evaluator
.
ref
).
id
)
teardown_build
=
create
(
:ci_build
,
:manual
,
name:
"
#{
deployment
.
environment
.
name
}
:teardown"
,
...
...
spec/services/ci/stop_environments_service_spec.rb
View file @
ceb06983
...
...
@@ -9,7 +9,8 @@ describe Ci::StopEnvironmentsService, services: true do
describe
'#execute'
do
context
'when environment with review app exists'
do
before
do
create
(
:environment
,
:with_review_app
,
project:
project
)
create
(
:environment
,
:with_review_app
,
project:
project
,
ref:
'feature'
)
end
context
'when user has permission to stop environment'
do
...
...
@@ -17,8 +18,16 @@ describe Ci::StopEnvironmentsService, services: true do
project
.
team
<<
[
user
,
:developer
]
end
it
'stops environment'
do
expect_environment_stopped_on
(
'master'
)
context
'when environment is associated with removed branch'
do
it
'stops environment'
do
expect_environment_stopped_on
(
'feature'
)
end
end
context
'when environment is associated with different branch'
do
it
'does not stop environment'
do
expect_environment_not_stopped_on
(
'master'
)
end
end
context
'when specified branch does not exist'
do
...
...
@@ -40,7 +49,7 @@ describe Ci::StopEnvironmentsService, services: true do
end
it
'does not stop environment'
do
expect_environment_not_stopped_on
(
'
master
'
)
expect_environment_not_stopped_on
(
'
feature
'
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment