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
445a4109
Commit
445a4109
authored
Dec 05, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up clusters_controller_spec.rb
parent
a5109c69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
27 deletions
+13
-27
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+13
-27
No files found.
spec/controllers/projects/clusters_controller_spec.rb
View file @
445a4109
...
...
@@ -120,7 +120,7 @@ describe Projects::ClustersController do
end
describe
'PUT update'
do
context
'
Managed
'
do
context
'
when cluster is provided by GCP
'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -171,7 +171,7 @@ describe Projects::ClustersController do
end
end
context
'
U
ser'
do
context
'
when cluster is provided by u
ser'
do
let
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
,
projects:
[
project
])
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -203,23 +203,11 @@ describe Projects::ClustersController do
expect
(
cluster
.
name
).
to
eq
(
'my-new-cluster-name'
)
expect
(
cluster
.
platform_kubernetes
.
namespace
).
to
eq
(
'my-namespace'
)
end
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:providing_by_gcp
,
projects:
[
project
])
}
it
"rejects changes"
do
go
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
cluster
.
enabled
).
to
be_truthy
end
end
end
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provid
ing
_by_gcp
,
projects:
[
project
])
}
set
(
:cluster
)
{
create
(
:cluster
,
:provid
ed
_by_gcp
,
projects:
[
project
])
}
let
(
:params
)
do
{
cluster:
{
enabled:
false
}
}
...
...
@@ -251,7 +239,7 @@ describe Projects::ClustersController do
sign_in
(
user
)
end
context
'GCP'
do
context
'
when cluster is provided by
GCP'
do
context
'when cluster is created'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
...
...
@@ -280,19 +268,17 @@ describe Projects::ClustersController do
end
end
context
'User'
do
context
'when provider is user'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
,
projects:
[
project
])
}
context
'when cluster is provided by user'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
,
projects:
[
project
])
}
it
"destroys and redirects back to clusters list"
do
expect
{
go
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}.
by
(
0
)
it
"destroys and redirects back to clusters list"
do
expect
{
go
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Platforms
::
Kubernetes
.
count
}.
by
(
-
1
)
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}.
by
(
0
)
expect
(
response
).
to
redirect_to
(
project_clusters_path
(
project
))
expect
(
flash
[
:notice
]).
to
eq
(
'Cluster integration was successfully removed.'
)
end
expect
(
response
).
to
redirect_to
(
project_clusters_path
(
project
))
expect
(
flash
[
:notice
]).
to
eq
(
'Cluster integration was successfully removed.'
)
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