summaryrefslogtreecommitdiff
path: root/spec/services/security/ci_configuration/sast_parser_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/security/ci_configuration/sast_parser_service_spec.rb')
-rw-r--r--spec/services/security/ci_configuration/sast_parser_service_spec.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/spec/services/security/ci_configuration/sast_parser_service_spec.rb b/spec/services/security/ci_configuration/sast_parser_service_spec.rb
index 4fe99f20879..4346d0a9e07 100644
--- a/spec/services/security/ci_configuration/sast_parser_service_spec.rb
+++ b/spec/services/security/ci_configuration/sast_parser_service_spec.rb
@@ -3,11 +3,13 @@
require 'spec_helper'
RSpec.describe Security::CiConfiguration::SastParserService do
+ include Ci::TemplateHelpers
+
describe '#configuration' do
include_context 'read ci configuration for sast enabled project'
let(:configuration) { described_class.new(project).configuration }
- let(:secure_analyzers_prefix) { configuration['global'][0] }
+ let(:secure_analyzers) { configuration['global'][0] }
let(:sast_excluded_paths) { configuration['global'][1] }
let(:sast_pipeline_stage) { configuration['pipeline'][0] }
let(:sast_search_max_depth) { configuration['pipeline'][1] }
@@ -16,7 +18,7 @@ RSpec.describe Security::CiConfiguration::SastParserService do
let(:sast_brakeman_level) { brakeman['variables'][0] }
it 'parses the configuration for SAST' do
- expect(secure_analyzers_prefix['default_value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers')
+ expect(secure_analyzers['default_value']).to eql(secure_analyzers_prefix)
expect(sast_excluded_paths['default_value']).to eql('spec, test, tests, tmp')
expect(sast_pipeline_stage['default_value']).to eql('test')
expect(sast_search_max_depth['default_value']).to eql('4')
@@ -28,7 +30,7 @@ RSpec.describe Security::CiConfiguration::SastParserService do
context 'when .gitlab-ci.yml is present' do
it 'populates the current values from the file' do
allow(project.repository).to receive(:blob_data_at).and_return(gitlab_ci_yml_content)
- expect(secure_analyzers_prefix['value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers2')
+ expect(secure_analyzers['value']).to eql("registry.gitlab.com/gitlab-org/security-products/analyzers2")
expect(sast_excluded_paths['value']).to eql('spec, executables')
expect(sast_pipeline_stage['value']).to eql('our_custom_security_stage')
expect(sast_search_max_depth['value']).to eql('8')
@@ -50,7 +52,7 @@ RSpec.describe Security::CiConfiguration::SastParserService do
context 'when .gitlab-ci.yml is absent' do
it 'populates the current values with the default values' do
allow(project.repository).to receive(:blob_data_at).and_return(nil)
- expect(secure_analyzers_prefix['value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers')
+ expect(secure_analyzers['value']).to eql(secure_analyzers_prefix)
expect(sast_excluded_paths['value']).to eql('spec, test, tests, tmp')
expect(sast_pipeline_stage['value']).to eql('test')
expect(sast_search_max_depth['value']).to eql('4')
@@ -67,7 +69,7 @@ RSpec.describe Security::CiConfiguration::SastParserService do
end
it 'populates the current values with the default values' do
- expect(secure_analyzers_prefix['value']).to eql('registry.gitlab.com/gitlab-org/security-products/analyzers')
+ expect(secure_analyzers['value']).to eql(secure_analyzers_prefix)
expect(sast_excluded_paths['value']).to eql('spec, test, tests, tmp')
expect(sast_pipeline_stage['value']).to eql('test')
expect(sast_search_max_depth['value']).to eql('4')