diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/admin/admin_settings_spec.rb | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/security/scan_configuration_spec.rb | 33 | ||||
-rw-r--r-- | spec/presenters/projects/security/configuration_presenter_spec.rb | 3 |
3 files changed, 31 insertions, 15 deletions
diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 46311c5f6e7..ca452264c02 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -814,6 +814,16 @@ RSpec.describe 'Admin updates settings' do expect(page).to have_button 'Hide payload' expect(page).to have_content expected_payload_content end + + it 'generates usage ping payload on button click', :js do + expect_next_instance_of(Admin::ApplicationSettingsController) do |instance| + expect(instance).to receive(:usage_data).and_call_original + end + + click_button('Download payload') + + wait_for_requests + end end end diff --git a/spec/lib/gitlab/security/scan_configuration_spec.rb b/spec/lib/gitlab/security/scan_configuration_spec.rb index 0af029968e8..3e2bb07ec6b 100644 --- a/spec/lib/gitlab/security/scan_configuration_spec.rb +++ b/spec/lib/gitlab/security/scan_configuration_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe ::Gitlab::Security::ScanConfiguration do + using RSpec::Parameterized::TableSyntax + let_it_be(:project) { create(:project, :repository) } let(:scan) { described_class.new(project: project, type: type, configured: configured) } @@ -13,9 +15,11 @@ RSpec.describe ::Gitlab::Security::ScanConfiguration do let(:configured) { true } context 'with a core scanner' do - let(:type) { :sast } + where(type: %i(sast sast_iac secret_detection)) - it { is_expected.to be_truthy } + with_them do + it { is_expected.to be_truthy } + end end context 'with custom scanner' do @@ -38,27 +42,28 @@ RSpec.describe ::Gitlab::Security::ScanConfiguration do subject { scan.configuration_path } let(:configured) { true } + let(:type) { :sast } - context 'with a non configurable scanner' do - let(:type) { :secret_detection } + it { is_expected.to be_nil } + end - it { is_expected.to be_nil } - end + describe '#can_enable_in_merge_request?' do + subject { scan.can_enable_in_merge_request? } - context 'with licensed scanner for FOSS environment' do - let(:type) { :dast } + let(:configured) { true } - before do - stub_env('FOSS_ONLY', '1') - end + context 'with a core scanner' do + where(type: %i(sast sast_iac secret_detection)) - it { is_expected.to be_nil } + with_them do + it { is_expected.to be_truthy } + end end - context 'with custom scanner' do + context 'with a custom scanner' do let(:type) { :my_scanner } - it { is_expected.to be_nil } + it { is_expected.to be_falsey } end end end diff --git a/spec/presenters/projects/security/configuration_presenter_spec.rb b/spec/presenters/projects/security/configuration_presenter_spec.rb index f9150179ae5..a400e58d6a4 100644 --- a/spec/presenters/projects/security/configuration_presenter_spec.rb +++ b/spec/presenters/projects/security/configuration_presenter_spec.rb @@ -86,8 +86,9 @@ RSpec.describe Projects::Security::ConfigurationPresenter do expect(feature['type']).to eq('sast') expect(feature['configured']).to eq(true) - expect(feature['configuration_path']).to eq(project_security_configuration_sast_path(project)) + expect(feature['configuration_path']).to be_nil expect(feature['available']).to eq(true) + expect(feature['can_enable_in_merge_request']).to eq(true) end context 'when checking features configured status' do |