summaryrefslogtreecommitdiff
path: root/spec/models/ci
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/models/ci
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/models/ci')
-rw-r--r--spec/models/ci/artifact_spec.rb59
-rw-r--r--spec/models/ci/build_spec.rb2
-rw-r--r--spec/models/ci/job_artifact_spec.rb30
3 files changed, 31 insertions, 60 deletions
diff --git a/spec/models/ci/artifact_spec.rb b/spec/models/ci/artifact_spec.rb
deleted file mode 100644
index 5e39f73763b..00000000000
--- a/spec/models/ci/artifact_spec.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require 'spec_helper'
-
-describe Ci::Artifact do
- it { is_expected.to belong_to(:project) }
- it { is_expected.to belong_to(:build) }
-
- it { is_expected.to respond_to(:file) }
- it { is_expected.to respond_to(:created_at) }
- it { is_expected.to respond_to(:updated_at) }
- it { is_expected.to respond_to(:type) }
-
- let(:artifact) { create(:artifact) }
-
- describe '#type' do
- it 'defaults to archive' do
- expect(artifact.type).to eq("archive")
- end
- end
-
- describe '#set_size' do
- it 'sets the size' do
- expect(artifact.size).to eq(106365)
- end
- end
-
- describe '#file' do
- subject { artifact.file }
-
- context 'the uploader api' do
- it { is_expected.to respond_to(:store_dir) }
- it { is_expected.to respond_to(:cache_dir) }
- it { is_expected.to respond_to(:work_dir) }
- end
- end
-
- describe '#remove_file' do
- it 'removes the file from the database' do
- artifact.remove_file!
-
- expect(artifact.file.exists?).to be_falsy
- end
- end
-
- describe '#exists?' do
- context 'when the artifact file is present' do
- it 'is returns true' do
- expect(artifact.exists?).to be(true)
- end
- end
-
- context 'when the file has been removed' do
- it 'does not exist' do
- artifact.remove_file!
-
- expect(artifact.exists?).to be_falsy
- end
- end
- end
-end
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 52a3732d0cd..f8dbed91c1a 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -146,7 +146,7 @@ describe Ci::Build do
it { is_expected.to be_truthy }
context 'is expired' do
- let(:build) { create(:ci_build, :artifacts, :expired) }
+ let!(:build) { create(:ci_build, :artifacts, :expired) }
it { is_expected.to be_falsy }
end
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb
new file mode 100644
index 00000000000..5202a8183af
--- /dev/null
+++ b/spec/models/ci/job_artifact_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+describe Ci::JobArtifact do
+ set(:artifact) { create(:ci_job_artifact) }
+
+ describe "Associations" do
+ it { is_expected.to belong_to(:project) }
+ it { is_expected.to belong_to(:job) }
+ end
+
+ it { is_expected.to respond_to(:file) }
+ it { is_expected.to respond_to(:created_at) }
+ it { is_expected.to respond_to(:updated_at) }
+
+ describe '#set_size' do
+ it 'sets the size' do
+ expect(artifact.size).to eq(106365)
+ end
+ end
+
+ describe '#file' do
+ subject { artifact.file }
+
+ context 'the uploader api' do
+ it { is_expected.to respond_to(:store_dir) }
+ it { is_expected.to respond_to(:cache_dir) }
+ it { is_expected.to respond_to(:work_dir) }
+ end
+ end
+end