diff options
Diffstat (limited to 'spec/models/ci/job_artifact_spec.rb')
-rw-r--r-- | spec/models/ci/job_artifact_spec.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index 6f6ff3704b4..80b619ed2b1 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -349,16 +349,13 @@ describe Ci::JobArtifact do end describe 'file is being stored' do - subject { create(:ci_job_artifact, :archive) } - context 'when object has nil store' do - before do - subject.update_column(:file_store, nil) - subject.reload - end - it 'is stored locally' do - expect(subject.file_store).to be(nil) + subject = build(:ci_job_artifact, :archive, file_store: nil) + + subject.save + + expect(subject.file_store).to be(ObjectStorage::Store::LOCAL) expect(subject.file).to be_file_storage expect(subject.file.object_store).to eq(ObjectStorage::Store::LOCAL) end @@ -366,6 +363,10 @@ describe Ci::JobArtifact do context 'when existing object has local store' do it 'is stored locally' do + subject = build(:ci_job_artifact, :archive) + + subject.save + expect(subject.file_store).to be(ObjectStorage::Store::LOCAL) expect(subject.file).to be_file_storage expect(subject.file.object_store).to eq(ObjectStorage::Store::LOCAL) @@ -379,6 +380,10 @@ describe Ci::JobArtifact do context 'when file is stored' do it 'is stored remotely' do + subject = build(:ci_job_artifact, :archive) + + subject.save + expect(subject.file_store).to eq(ObjectStorage::Store::REMOTE) expect(subject.file).not_to be_file_storage expect(subject.file.object_store).to eq(ObjectStorage::Store::REMOTE) |