diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/artifacts_spec.rb | 48 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/reports_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/trigger_spec.rb | 13 |
3 files changed, 40 insertions, 23 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb index 513a9b8f2b4..8cfd07df777 100644 --- a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb @@ -123,25 +123,53 @@ describe Gitlab::Ci::Config::Entry::Artifacts do end end end + end - context 'when feature flag :ci_expose_arbitrary_artifacts_in_mr is disabled' do + describe 'excluded artifacts' do + context 'when configuration is valid and the feature is enabled' do before do - stub_feature_flags(ci_expose_arbitrary_artifacts_in_mr: false) + stub_feature_flags(ci_artifacts_exclude: true) end - context 'when syntax is correct' do - let(:config) { { expose_as: 'Test results', paths: ['test.txt'] } } + context 'when configuration is valid' do + let(:config) { { untracked: true, exclude: ['some/directory/'] } } - it 'is valid' do - expect(entry.errors).to be_empty + it 'correctly parses the configuration' do + expect(entry).to be_valid + expect(entry.value).to eq config end end - context 'when syntax for :expose_as is incorrect' do - let(:config) { { paths: %w[results.txt], expose_as: '' } } + context 'when configuration is not valid' do + let(:config) { { untracked: true, exclude: 1234 } } + + it 'returns an error' do + expect(entry).not_to be_valid + expect(entry.errors) + .to include 'artifacts exclude should be an array of strings' + end + end + end + + context 'when artifacts/exclude feature is disabled' do + before do + stub_feature_flags(ci_artifacts_exclude: false) + end + + context 'when configuration has been provided' do + let(:config) { { untracked: true, exclude: ['some/directory/'] } } + + it 'returns an error' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'artifacts exclude feature is disabled' + end + end + + context 'when configuration is not present' do + let(:config) { { untracked: true } } - it 'is valid' do - expect(entry.errors).to be_empty + it 'is a valid configuration' do + expect(entry).to be_valid end end end diff --git a/spec/lib/gitlab/ci/config/entry/reports_spec.rb b/spec/lib/gitlab/ci/config/entry/reports_spec.rb index 9bba3eb2b77..8c6c91d919e 100644 --- a/spec/lib/gitlab/ci/config/entry/reports_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/reports_spec.rb @@ -47,6 +47,8 @@ describe Gitlab::Ci::Config::Entry::Reports do :dotenv | 'build.dotenv' :cobertura | 'cobertura-coverage.xml' :terraform | 'tfplan.json' + :accessibility | 'gl-accessibility.json' + :cluster_applications | 'gl-cluster-applications.json' end with_them do diff --git a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb index 752c3f59a95..dfd9807583c 100644 --- a/spec/lib/gitlab/ci/config/entry/trigger_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/trigger_spec.rb @@ -114,19 +114,6 @@ describe Gitlab::Ci::Config::Entry::Trigger do .to match /config contains unknown keys: branch/ end end - - context 'when feature flag is off' do - before do - stub_feature_flags(ci_parent_child_pipeline: false) - end - - let(:config) { { include: 'path/to/config.yml' } } - - it 'is returns an error if include is used' do - expect(subject.errors.first) - .to match /config must specify project/ - end - end end context 'when config contains unknown keys' do |