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
Léo-Paul Géneau
gitlab-ce
Commits
32a400aa
Commit
32a400aa
authored
Jun 15, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make environments_spec more feature-spec
parent
18fd2ccb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
57 deletions
+56
-57
spec/features/environments_spec.rb
spec/features/environments_spec.rb
+56
-57
No files found.
spec/features/environments_spec.rb
View file @
32a400aa
require
'spec_helper'
describe
'Environments'
do
include
GitlabRoutingHelper
feature
'Environments'
,
feature:
true
do
given
(
:project
)
{
create
(
:empty_project
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:role
)
{
:developer
}
before
do
background
do
login_as
(
user
)
project
.
team
<<
[
user
,
role
]
end
describe
'GET /:project/environments'
do
subject
{
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
}
describe
'when showing environments'
do
given!
(
:environment
)
{
}
given!
(
:deployment
)
{
}
context
'without environments'
do
it
'does show no environments'
do
subject
before
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
end
context
'without environments'
do
scenario
'does show no environments'
do
expect
(
page
).
to
have_content
(
'No environments to show'
)
end
end
context
'with environments'
do
let!
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
it
'does show environment name'
do
subject
given
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
scenario
'does show environment name'
do
expect
(
page
).
to
have_link
(
environment
.
name
)
end
context
'without deployments'
do
it
'does show no deployments'
do
subject
scenario
'does show no deployments'
do
expect
(
page
).
to
have_content
(
'No deployments yet'
)
end
end
context
'with deployments'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
it
'does show deployment SHA'
do
subject
given
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
scenario
'does show deployment SHA'
do
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
end
end
end
it
'does have a New environment button'
do
subject
scenario
'does have a New environment button'
do
expect
(
page
).
to
have_link
(
'New environment'
)
end
end
describe
'GET /:project/environments/:id'
do
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
describe
'when showing the environment'
do
given
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
given!
(
:deployment
)
{
}
subject
{
visit
namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
}
before
do
visit
namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
end
context
'without deployments'
do
it
'does show no deployments'
do
subject
scenario
'does show no deployments'
do
expect
(
page
).
to
have_content
(
'No deployments for'
)
end
end
context
'with deployments'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
given
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
before
{
subject
}
it
'does show deployment SHA'
do
scenario
'does show deployment SHA'
do
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
end
it
'does not show a retry button for deployment without build'
do
scenario
'does not show a retry button for deployment without build'
do
expect
(
page
).
not_to
have_link
(
'Retry'
)
end
context
'with build'
do
let
(
:build
)
{
create
(
:ci_build
,
project:
project
)
}
let
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
)
}
given
(
:build
)
{
create
(
:ci_build
,
project:
project
)
}
given
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
)
}
it
'does show build name'
do
scenario
'does show build name'
do
expect
(
page
).
to
have_link
(
"
#{
build
.
name
}
(#
#{
build
.
id
}
)"
)
end
it
'does show retry button'
do
scenario
'does show retry button'
do
expect
(
page
).
to
have_link
(
'Retry'
)
end
end
end
end
describe
'POST /:project/environments'
do
before
{
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
}
describe
'when creating a new environment'
do
before
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
end
context
'when logged as developer'
do
before
{
click_link
'New environment'
}
before
do
click_link
'New environment'
end
context
'for valid name'
do
before
do
...
...
@@ -111,7 +107,7 @@ describe 'Environments' do
click_on
'Create environment'
end
it
'does create a new pipeline'
do
scenario
'does create a new pipeline'
do
expect
(
page
).
to
have_content
(
'production'
)
end
end
...
...
@@ -122,38 +118,41 @@ describe 'Environments' do
click_on
'Create environment'
end
it
{
expect
(
page
).
to
have_content
(
'Name can contain only letters'
)
}
scenario
'does show errors'
do
expect
(
page
).
to
have_content
(
'Name can contain only letters'
)
end
end
end
context
'when logged as reporter'
do
let
(
:role
)
{
:reporter
}
given
(
:role
)
{
:reporter
}
it
'does not have a New environment link'
do
scenario
'does not have a New environment link'
do
expect
(
page
).
not_to
have_link
(
'New environment'
)
end
end
end
describe
'
DELETE /:project/environments/:id
'
do
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
describe
'
when deleting existing environment
'
do
given
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
before
{
visit
namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
}
before
do
visit
namespace_project_environment_path
(
project
.
namespace
,
project
,
environment
)
end
context
'when logged as master'
do
let
(
:role
)
{
:master
}
before
{
click_link
'Destroy'
}
given
(
:role
)
{
:master
}
it
'does not have environment'
do
scenario
'does delete environment'
do
click_link
'Destroy'
expect
(
page
).
not_to
have_link
(
environment
.
name
)
end
end
context
'when logged as developer'
do
let
(
:role
)
{
:developer
}
given
(
:role
)
{
:developer
}
it
'does not have a Destroy link'
do
scenario
'does not have a Destroy link'
do
expect
(
page
).
not_to
have_link
(
'Destroy'
)
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