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
b7f35360
Commit
b7f35360
authored
Dec 01, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs JSON PUT #delete for ClustersController
parent
5fb8b2f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
18 deletions
+55
-18
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+55
-18
No files found.
spec/controllers/projects/clusters_controller_spec.rb
View file @
b7f35360
...
...
@@ -384,31 +384,61 @@ describe Projects::ClustersController do
sign_in
(
user
)
end
context
'when update enabled'
do
let
(
:params
)
do
{
cluster:
{
enabled:
false
}
}
end
context
'when format is json'
do
context
'when update enabled'
do
let
(
:params
)
do
{
cluster:
{
enabled:
false
}
}
end
it
"updates and redirects back to show page"
do
go
it
"updates and redirects back to show page"
do
go_json
cluster
.
reload
expect
(
response
).
to
have_http_status
(
:no_content
)
end
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:project
,
:providing_by_gcp
)
}
it
"rejects changes"
do
go_json
cluster
.
reload
expect
(
response
).
to
redirect_to
(
project_cluster_path
(
project
,
project
.
cluster
)
)
expect
(
flash
[
:notice
]).
to
eq
(
'Cluster was successfully updated.'
)
e
xpect
(
cluster
.
enabled
).
to
be_falsey
# head bad_request
expect
(
response
).
to
have_http_status
(
:bad_request
)
end
e
nd
end
end
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:project
,
:providing_by_gcp
)
}
context
'when format is html'
do
context
'when update enabled'
do
let
(
:params
)
do
{
cluster:
{
enabled:
false
}
}
end
it
"
rejects changes
"
do
it
"
updates and redirects back to show page
"
do
go
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:show
)
expect
(
cluster
.
enabled
).
to
be_truthy
cluster
.
reload
expect
(
response
).
to
redirect_to
(
project_cluster_path
(
project
,
project
.
cluster
))
expect
(
flash
[
:notice
]).
to
eq
(
'Cluster was successfully updated.'
)
expect
(
cluster
.
enabled
).
to
be_falsey
end
context
'when cluster is being created'
do
let
(
:cluster
)
{
create
(
:cluster
,
:project
,
:providing_by_gcp
)
}
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
...
...
@@ -436,6 +466,13 @@ describe Projects::ClustersController do
project_id:
project
,
id:
cluster
)
end
def
go_json
put
:update
,
params
.
merge
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
cluster
,
format: :json
)
end
end
describe
'delete update'
do
...
...
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