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/features/file_uploads/ci_artifact_spec.rb')
-rw-r--r--spec/features/file_uploads/ci_artifact_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/features/file_uploads/ci_artifact_spec.rb b/spec/features/file_uploads/ci_artifact_spec.rb
new file mode 100644
index 00000000000..4f3b6c90ad4
--- /dev/null
+++ b/spec/features/file_uploads/ci_artifact_spec.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Upload ci artifact', :api, :js do
+ include_context 'file upload requests helpers'
+
+ let_it_be(:user) { create(:user, :admin) }
+ let_it_be(:project) { create(:project) }
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project, ref: 'master') }
+ let_it_be(:runner) { create(:ci_runner, :project, projects: [project]) }
+ let_it_be(:job) { create(:ci_build, :running, user: user, project: project, pipeline: pipeline, runner_id: runner.id) }
+
+ let(:api_path) { "/jobs/#{job.id}/artifacts?token=#{job.token}" }
+ let(:url) { capybara_url(api(api_path)) }
+ let(:file) { fixture_file_upload('spec/fixtures/ci_build_artifacts.zip') }
+
+ subject do
+ HTTParty.post(url, body: { file: file })
+ end
+
+ RSpec.shared_examples 'for ci artifact' do
+ it { expect { subject }.to change { ::Ci::JobArtifact.count }.by(2) }
+
+ it { expect(subject.code).to eq(201) }
+ end
+
+ it_behaves_like 'handling file uploads', 'for ci artifact'
+end