diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 12:38:34 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 12:38:34 +0300 |
commit | 60e0137c864e26fee0120dc4447bb95acc46ce51 (patch) | |
tree | 98e9bc8f87c048844655bdd587fa782089002215 /spec/workers/expire_build_artifacts_worker_spec.rb | |
parent | 278a0e1a0fb094dc2eceec0d82d9a56be81c8046 (diff) |
Fix specs
Diffstat (limited to 'spec/workers/expire_build_artifacts_worker_spec.rb')
-rw-r--r-- | spec/workers/expire_build_artifacts_worker_spec.rb | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/workers/expire_build_artifacts_worker_spec.rb b/spec/workers/expire_build_artifacts_worker_spec.rb index eb8afb20275..e3827cae9a6 100644 --- a/spec/workers/expire_build_artifacts_worker_spec.rb +++ b/spec/workers/expire_build_artifacts_worker_spec.rb @@ -11,37 +11,45 @@ describe ExpireBuildArtifactsWorker do subject! { worker.perform } context 'with expired artifacts' do - let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now - 7.days) } + let(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now - 7.days) } it 'does expire' do expect(build.reload.artifacts_expired?).to be_truthy end + + it 'does remove files' do + expect(build.reload.artifacts_file.exists?).to be_falsey + end end context 'with not yet expired artifacts' do - let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days) } + let(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days) } it 'does not expire' do - expect(build.reload.artifacts_expired?).to be_truthy + expect(build.reload.artifacts_expired?).to be_falsey + end + + it 'does not remove files' do + expect(build.reload.artifacts_file.exists?).to be_truthy end end context 'without expire date' do - let!(:build) { create(:ci_build, :artifacts) } + let(:build) { create(:ci_build, :artifacts) } it 'does not expire' do expect(build.reload.artifacts_expired?).to be_falsey end + + it 'does not remove files' do + expect(build.reload.artifacts_file.exists?).to be_truthy + end end context 'for expired artifacts' do - let!(:build) { create(:ci_build, artifacts_expire_at: Time.now - 7.days) } + let(:build) { create(:ci_build, artifacts_expire_at: Time.now - 7.days) } - it 'does not erase artifacts' do - expect_any_instance_of(Ci::Build).not_to have_received(:erase_artifacts!) - end - - it 'does expire' do + it 'is still expired' do expect(build.reload.artifacts_expired?).to be_truthy end end |