diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-13 16:05:23 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-13 16:05:23 +0200 |
commit | c534d2e89ed00ff98c83a197674b5ac66a8aca93 (patch) | |
tree | fff30847f9198fe4e46f2cde132ad45e471f2894 /spec/workers | |
parent | b0b1b85d7197b211c472779c07410de70b39e548 (diff) | |
download | gitlab-ce-c534d2e89ed00ff98c83a197674b5ac66a8aca93.tar.gz |
Improve tests
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/expire_build_artifacts_worker_spec.rb | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/spec/workers/expire_build_artifacts_worker_spec.rb b/spec/workers/expire_build_artifacts_worker_spec.rb index 501ca630e55..8168ad98062 100644 --- a/spec/workers/expire_build_artifacts_worker_spec.rb +++ b/spec/workers/expire_build_artifacts_worker_spec.rb @@ -6,14 +6,14 @@ describe ExpireBuildArtifactsWorker do let(:worker) { described_class.new } describe '#perform' do - context 'with expired artifacts' do - let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now - 7.days) } + before { build } - it do - expect_any_instance_of(Ci::Build).to receive(:erase_artifacts!) + subject! { worker.perform } - worker.perform + context 'with expired artifacts' do + 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 end @@ -21,22 +21,16 @@ describe ExpireBuildArtifactsWorker do context 'with not yet expired artifacts' do let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: Time.now + 7.days) } - it do - expect_any_instance_of(Ci::Build).not_to receive(:erase_artifacts!) - - worker.perform - - expect(build.reload.artifacts_expired?).to be_falsey + it 'does not expire' do + expect(build.reload.artifacts_expired?).to be_truthy end end context 'without expire date' do let!(:build) { create(:ci_build, :artifacts) } - it do - expect_any_instance_of(Ci::Build).not_to receive(:erase_artifacts!) - - worker.perform + it 'does not expire' do + expect(build.reload.artifacts_expired?).to be_falsey end end |