diff options
Diffstat (limited to 'spec/controllers/projects/security')
-rw-r--r-- | spec/controllers/projects/security/configuration_controller_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/projects/security/configuration_controller_spec.rb b/spec/controllers/projects/security/configuration_controller_spec.rb index 848db16fb02..1ce0fcd85db 100644 --- a/spec/controllers/projects/security/configuration_controller_spec.rb +++ b/spec/controllers/projects/security/configuration_controller_spec.rb @@ -36,6 +36,31 @@ RSpec.describe Projects::Security::ConfigurationController do expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template(:show) end + + it 'responds with configuration data json' do + get :show, params: { namespace_id: project.namespace, project_id: project, format: :json } + + features = json_response['features'] + sast_feature = features.find { |feature| feature['type'] == 'sast' } + dast_feature = features.find { |feature| feature['type'] == 'dast' } + + expect(response).to have_gitlab_http_status(:ok) + expect(sast_feature['available']).to be_truthy + expect(dast_feature['available']).to be_falsey + end + + context 'with feature flag unify_security_configuration turned off' do + before do + stub_feature_flags(unify_security_configuration: false) + end + + it 'responds with empty configuration data json' do + get :show, params: { namespace_id: project.namespace, project_id: project, format: :json } + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to be_empty + end + end end end end |