summaryrefslogtreecommitdiff
path: root/spec/uploaders
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-09-21 10:34:12 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-12-03 12:04:48 +0100
commit61864a5a5bb523953589c9398a431c4369fbfc76 (patch)
tree5eac32ef8155e9066d7d1488d7856e83605aa6a5 /spec/uploaders
parent25df666156279e5b392b429519b4f4ba01eefaac (diff)
downloadgitlab-ce-61864a5a5bb523953589c9398a431c4369fbfc76.tar.gz
Rename Artifact to JobArtifact, split metadata out
Two things at ones, as there was no clean way to seperate the commit and give me feedback from the tests. But the model Artifact is now JobArtifact, and the table does not have a type anymore, but the metadata is now its own model: Ci::JobArtifactMetadata.
Diffstat (limited to 'spec/uploaders')
-rw-r--r--spec/uploaders/artifact_uploader_spec.rb4
-rw-r--r--spec/uploaders/job_artifact_uploader_spec.rb15
2 files changed, 17 insertions, 2 deletions
diff --git a/spec/uploaders/artifact_uploader_spec.rb b/spec/uploaders/artifact_uploader_spec.rb
index 2a3bd0e3bb2..9cb2c090b43 100644
--- a/spec/uploaders/artifact_uploader_spec.rb
+++ b/spec/uploaders/artifact_uploader_spec.rb
@@ -1,7 +1,7 @@
require 'rails_helper'
describe ArtifactUploader do
- let(:job) { create(:ci_build) }
+ set(:job) { create(:ci_build) }
let(:uploader) { described_class.new(job, :artifacts_file) }
let(:path) { Gitlab.config.artifacts.path }
@@ -26,7 +26,7 @@ describe ArtifactUploader do
subject { uploader.store_dir }
it { is_expected.to start_with(path) }
- it { is_expected.to end_with("#{job.project_id}/#{job.id}") }
+ it { is_expected.to end_with("#{job.project_id}/#{job.created_at.utc.strftime('%Y_%m')}/#{job.id}") }
end
describe '#cache_dir' do
diff --git a/spec/uploaders/job_artifact_uploader_spec.rb b/spec/uploaders/job_artifact_uploader_spec.rb
new file mode 100644
index 00000000000..d045acf9089
--- /dev/null
+++ b/spec/uploaders/job_artifact_uploader_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+describe JobArtifactUploader do
+ set(:job_artifact) { create(:ci_job_artifact) }
+ let(:job) { job_artifact.job }
+ let(:uploader) { described_class.new(job_artifact, :file) }
+
+ describe '#store_dir' do
+ subject { uploader.store_dir }
+
+ it { is_expected.to start_with(Gitlab.config.artifacts.path) }
+ it { is_expected.not_to end_with("#{job.project_id}/#{job.created_at.utc.strftime('%Y_%m')}/#{job.id}") }
+ it { is_expected.to match(/\h{2}\/\h{2}\/\h{64}\/\d{4}_\d{1,2}_\d{1,2}\/\d+\/\d+\z/) }
+ end
+end