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
Tatuya Kamada
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'
require
'spec_helper'
describe
'Environments'
do
feature
'Environments'
,
feature:
true
do
include
GitlabRoutingHelper
given
(
:project
)
{
create
(
:empty_project
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
let
(
:project
)
{
create
(
:empty_project
)
}
background
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:role
)
{
:developer
}
before
do
login_as
(
user
)
login_as
(
user
)
project
.
team
<<
[
user
,
role
]
project
.
team
<<
[
user
,
role
]
end
end
describe
'GET /:project/environments'
do
describe
'when showing environments'
do
subject
{
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
}
given!
(
:environment
)
{
}
given!
(
:deployment
)
{
}
context
'without environments'
do
before
do
it
'does show no environments'
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
subject
end
context
'without environments'
do
scenario
'does show no environments'
do
expect
(
page
).
to
have_content
(
'No environments to show'
)
expect
(
page
).
to
have_content
(
'No environments to show'
)
end
end
end
end
context
'with environments'
do
context
'with environments'
do
let!
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
given
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
it
'does show environment name'
do
subject
scenario
'does show environment name'
do
expect
(
page
).
to
have_link
(
environment
.
name
)
expect
(
page
).
to
have_link
(
environment
.
name
)
end
end
context
'without deployments'
do
context
'without deployments'
do
it
'does show no deployments'
do
scenario
'does show no deployments'
do
subject
expect
(
page
).
to
have_content
(
'No deployments yet'
)
expect
(
page
).
to
have_content
(
'No deployments yet'
)
end
end
end
end
context
'with deployments'
do
context
'with deployments'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
given
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
it
'does show deployment SHA'
do
subject
scenario
'does show deployment SHA'
do
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
end
end
end
end
end
end
it
'does have a New environment button'
do
scenario
'does have a New environment button'
do
subject
expect
(
page
).
to
have_link
(
'New environment'
)
expect
(
page
).
to
have_link
(
'New environment'
)
end
end
end
end
describe
'GET /:project/environments/:id'
do
describe
'when showing the environment'
do
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
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
context
'without deployments'
do
it
'does show no deployments'
do
scenario
'does show no deployments'
do
subject
expect
(
page
).
to
have_content
(
'No deployments for'
)
expect
(
page
).
to
have_content
(
'No deployments for'
)
end
end
end
end
context
'with deployments'
do
context
'with deployments'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
given
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
before
{
subject
}
scenario
'does show deployment SHA'
do
it
'does show deployment SHA'
do
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
expect
(
page
).
to
have_link
(
deployment
.
short_sha
)
end
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'
)
expect
(
page
).
not_to
have_link
(
'Retry'
)
end
end
context
'with build'
do
context
'with build'
do
let
(
:build
)
{
create
(
:ci_build
,
project:
project
)
}
given
(
:build
)
{
create
(
:ci_build
,
project:
project
)
}
let
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
deployable:
build
)
}
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
}
)"
)
expect
(
page
).
to
have_link
(
"
#{
build
.
name
}
(#
#{
build
.
id
}
)"
)
end
end
it
'does show retry button'
do
scenario
'does show retry button'
do
expect
(
page
).
to
have_link
(
'Retry'
)
expect
(
page
).
to
have_link
(
'Retry'
)
end
end
end
end
end
end
end
end
describe
'POST /:project/environments'
do
describe
'when creating a new environment'
do
before
{
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
}
before
do
visit
namespace_project_environments_path
(
project
.
namespace
,
project
)
end
context
'when logged as developer'
do
context
'when logged as developer'
do
before
{
click_link
'New environment'
}
before
do
click_link
'New environment'
end
context
'for valid name'
do
context
'for valid name'
do
before
do
before
do
...
@@ -111,7 +107,7 @@ describe 'Environments' do
...
@@ -111,7 +107,7 @@ describe 'Environments' do
click_on
'Create environment'
click_on
'Create environment'
end
end
it
'does create a new pipeline'
do
scenario
'does create a new pipeline'
do
expect
(
page
).
to
have_content
(
'production'
)
expect
(
page
).
to
have_content
(
'production'
)
end
end
end
end
...
@@ -122,38 +118,41 @@ describe 'Environments' do
...
@@ -122,38 +118,41 @@ describe 'Environments' do
click_on
'Create environment'
click_on
'Create environment'
end
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
end
end
context
'when logged as reporter'
do
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'
)
expect
(
page
).
not_to
have_link
(
'New environment'
)
end
end
end
end
end
end
describe
'
DELETE /:project/environments/:id
'
do
describe
'
when deleting existing environment
'
do
let
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
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
context
'when logged as master'
do
let
(
:role
)
{
:master
}
given
(
:role
)
{
:master
}
before
{
click_link
'Destroy'
}
it
'does not have environment'
do
scenario
'does delete environment'
do
click_link
'Destroy'
expect
(
page
).
not_to
have_link
(
environment
.
name
)
expect
(
page
).
not_to
have_link
(
environment
.
name
)
end
end
end
end
context
'when logged as developer'
do
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'
)
expect
(
page
).
not_to
have_link
(
'Destroy'
)
end
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