diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-01 19:57:29 +0200 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-05-01 20:01:28 +0200 |
commit | 5b153c6f0472687b24681f9cd98f4d0eed40bca9 (patch) | |
tree | e6d801bddb080e8b2b580b42f516456e82bf1830 | |
parent | decf287edf55d157c1d12d615f1f35497fa75098 (diff) | |
download | gitlab-ce-zj-upgrade-carrierwave.tar.gz |
Fix failing test after carrierwave upgradezj-upgrade-carrierwave
This was the only spec failure we had, consider me impressed. Does not
change behaviour, but changes where needed as the internals of the gem
changed.
-rw-r--r-- | app/workers/expire_build_instance_artifacts_worker.rb | 2 | ||||
-rw-r--r-- | spec/workers/expire_build_instance_artifacts_worker_spec.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/workers/expire_build_instance_artifacts_worker.rb b/app/workers/expire_build_instance_artifacts_worker.rb index eb403c134d1..7b59e976492 100644 --- a/app/workers/expire_build_instance_artifacts_worker.rb +++ b/app/workers/expire_build_instance_artifacts_worker.rb @@ -8,7 +8,7 @@ class ExpireBuildInstanceArtifactsWorker .reorder(nil) .find_by(id: build_id) - return unless build.try(:project) + return unless build&.project && !build.project.pending_delete Rails.logger.info "Removing artifacts for build #{build.id}..." build.erase_artifacts! diff --git a/spec/workers/expire_build_instance_artifacts_worker_spec.rb b/spec/workers/expire_build_instance_artifacts_worker_spec.rb index d202b3de77e..1d8da68883b 100644 --- a/spec/workers/expire_build_instance_artifacts_worker_spec.rb +++ b/spec/workers/expire_build_instance_artifacts_worker_spec.rb @@ -34,12 +34,14 @@ describe ExpireBuildInstanceArtifactsWorker do context 'when associated project was removed' do let(:build) do create(:ci_build, :artifacts, artifacts_expiry) do |build| - build.project.delete + build.project.pending_delete = true end end it 'does not remove artifacts' do - expect(build.reload.artifacts_file.exists?).to be_truthy + expect do + build.reload.artifacts_file + end.not_to raise_error end end end |