Commit b7f35360 authored by Matija Čupić's avatar Matija Čupić

Add specs JSON PUT #delete for ClustersController

parent 5fb8b2f7
......@@ -384,6 +384,35 @@ describe Projects::ClustersController do
sign_in(user)
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_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
# head bad_request
expect(response).to have_http_status(:bad_request)
end
end
end
end
context 'when format is html' do
context 'when update enabled' do
let(:params) do
{
......@@ -413,6 +442,7 @@ describe Projects::ClustersController do
end
end
end
end
describe 'security' do
let(:params) do
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment