Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
a88b2d3b
Commit
a88b2d3b
authored
Nov 14, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature tests for environments auto-close
parent
ceb06983
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
4 deletions
+39
-4
app/models/environment.rb
app/models/environment.rb
+1
-0
spec/features/environments_spec.rb
spec/features/environments_spec.rb
+38
-4
No files found.
app/models/environment.rb
View file @
a88b2d3b
...
...
@@ -92,6 +92,7 @@ class Environment < ActiveRecord::Base
def
stop!
(
current_user
)
return
unless
stoppable?
stop
stop_action
.
play
(
current_user
)
end
end
spec/features/environments_spec.rb
View file @
a88b2d3b
...
...
@@ -6,8 +6,8 @@ feature 'Environments', feature: true do
given
(
:role
)
{
:developer
}
background
do
login_as
(
user
)
project
.
team
<<
[
user
,
role
]
login_as
(
user
)
end
describe
'when showing environments'
do
...
...
@@ -16,7 +16,7 @@ feature 'Environments', feature: true do
given!
(
:manual
)
{
}
before
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
visit
_environments
(
project
)
end
context
'shows two tabs'
do
...
...
@@ -142,7 +142,7 @@ feature 'Environments', feature: true do
given!
(
:manual
)
{
}
before
do
visit
namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
visit
_environment
(
environment
)
end
context
'without deployments'
do
...
...
@@ -234,7 +234,7 @@ feature 'Environments', feature: true do
describe
'when creating a new environment'
do
before
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
visit
_environments
(
project
)
end
context
'when logged as developer'
do
...
...
@@ -273,4 +273,38 @@ feature 'Environments', feature: true do
end
end
end
feature
'auto-close environment when branch deleted'
do
given
(
:project
)
{
create
(
:project
)
}
given!
(
:environment
)
do
create
(
:environment
,
:with_review_app
,
project:
project
,
ref:
'feature'
)
end
scenario
'user visits environment page'
do
visit_environment
(
environment
)
expect
(
page
).
to
have_link
(
'Stop'
)
end
scenario
'user deletes the branch with running environment'
do
visit
namespace_project_branches_path
(
project
.
namespace
,
project
)
page
.
within
(
'.js-branch-feature'
)
{
find
(
'a.btn-remove'
).
click
}
visit_environment
(
environment
)
expect
(
page
).
to
have_no_link
(
'Stop'
)
end
end
def
visit_environments
(
project
)
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
end
def
visit_environment
(
environment
)
visit
namespace_project_environment_path
(
environment
.
project
.
namespace
,
environment
.
project
,
environment
)
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