Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/ci/find_exposed_artifacts_service_spec.rb')
-rw-r--r--spec/services/ci/find_exposed_artifacts_service_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/services/ci/find_exposed_artifacts_service_spec.rb b/spec/services/ci/find_exposed_artifacts_service_spec.rb
index f6309822fe0..b0f190b0e7a 100644
--- a/spec/services/ci/find_exposed_artifacts_service_spec.rb
+++ b/spec/services/ci/find_exposed_artifacts_service_spec.rb
@@ -50,10 +50,39 @@ describe Ci::FindExposedArtifactsService do
end
end
+ shared_examples 'does not find any matches' do
+ it 'returns empty array' do
+ expect(subject).to eq []
+ end
+ end
+
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
subject { described_class.new(project, user).for_pipeline(pipeline) }
+ context 'with jobs having no exposed artifacts' do
+ let!(:job) do
+ create_job_with_artifacts(artifacts: {
+ paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html']
+ })
+ end
+
+ it_behaves_like 'does not find any matches'
+ end
+
+ context 'with jobs having no artifacts (metadata)' do
+ let!(:job) do
+ create(:ci_build, pipeline: pipeline, options: {
+ artifacts: {
+ expose_as: 'Exposed artifact',
+ paths: ['other_artifacts_0.1.2/doc_sample.txt', 'something-else.html']
+ }
+ })
+ end
+
+ it_behaves_like 'does not find any matches'
+ end
+
context 'with jobs having at most 1 matching exposed artifact' do
let!(:job) do
create_job_with_artifacts(artifacts: {