Add more tests to Projects::Clusters::ApplicationsController
This commit is contained in:
parent
2b4fccb720
commit
f676f38815
|
@ -5,14 +5,12 @@ class Projects::Clusters::ApplicationsController < Projects::ApplicationControll
|
||||||
before_action :authorize_create_cluster!, only: [:create]
|
before_action :authorize_create_cluster!, only: [:create]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
scheduled = Clusters::Applications::ScheduleInstallationService.new(project, current_user,
|
Clusters::Applications::ScheduleInstallationService.new(project, current_user,
|
||||||
application_class: @application_class,
|
application_class: @application_class,
|
||||||
cluster: @cluster).execute
|
cluster: @cluster).execute
|
||||||
if scheduled
|
head :no_content
|
||||||
head :no_content
|
rescue StandardError
|
||||||
else
|
head :bad_request
|
||||||
head :bad_request
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -49,6 +49,19 @@ describe Projects::Clusters::ApplicationsController do
|
||||||
expect(response).to have_http_status(:not_found)
|
expect(response).to have_http_status(:not_found)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when application is already installing' do
|
||||||
|
before do
|
||||||
|
other = current_application.new(cluster: cluster)
|
||||||
|
other.make_installing!
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns 400' do
|
||||||
|
go
|
||||||
|
|
||||||
|
expect(response).to have_http_status(:bad_request)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'security' do
|
describe 'security' do
|
||||||
|
|
Loading…
Reference in New Issue