summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 00:09:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 00:09:34 +0000
commit3cd08f4bf96cda3e9d3abf233095107832b17c20 (patch)
treedc09a618783a79d70f2a404374d4b850ccf9cc84 /spec/workers
parentdd4bee69b7d55620f7dc9db8c36b478bd4959755 (diff)
downloadgitlab-ce-3cd08f4bf96cda3e9d3abf233095107832b17c20.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/project_update_repository_storage_worker_spec.rb11
-rw-r--r--spec/workers/x509_certificate_revoke_worker_spec.rb41
2 files changed, 44 insertions, 8 deletions
diff --git a/spec/workers/project_update_repository_storage_worker_spec.rb b/spec/workers/project_update_repository_storage_worker_spec.rb
index aa6545f7f89..4cc44281a69 100644
--- a/spec/workers/project_update_repository_storage_worker_spec.rb
+++ b/spec/workers/project_update_repository_storage_worker_spec.rb
@@ -9,16 +9,11 @@ describe ProjectUpdateRepositoryStorageWorker do
describe "#perform" do
it "calls the update repository storage service" do
- expect_any_instance_of(Projects::UpdateRepositoryStorageService)
- .to receive(:execute).with('new_storage')
+ expect_next_instance_of(Projects::UpdateRepositoryStorageService) do |instance|
+ expect(instance).to receive(:execute).with('new_storage')
+ end
subject.perform(project.id, 'new_storage')
end
-
- it 'catches and logs RepositoryAlreadyMoved' do
- expect(Rails.logger).to receive(:info).with(/repository already moved/)
-
- expect { subject.perform(project.id, project.repository_storage) }.not_to raise_error
- end
end
end
diff --git a/spec/workers/x509_certificate_revoke_worker_spec.rb b/spec/workers/x509_certificate_revoke_worker_spec.rb
new file mode 100644
index 00000000000..1e0cbf61267
--- /dev/null
+++ b/spec/workers/x509_certificate_revoke_worker_spec.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe X509CertificateRevokeWorker do
+ describe '#perform' do
+ context 'with a revoked certificate' do
+ subject { described_class.new }
+
+ let(:x509_certificate) { create(:x509_certificate, certificate_status: :revoked) }
+ let(:job_args) { x509_certificate.id }
+
+ include_examples 'an idempotent worker' do
+ it 'executes the revoke service' do
+ spy_service = X509CertificateRevokeService.new
+
+ allow(X509CertificateRevokeService).to receive(:new) { spy_service }
+
+ expect(spy_service).to receive(:execute)
+ .exactly(IdempotentWorkerHelper::WORKER_EXEC_TIMES).times
+ .with(x509_certificate)
+ .and_call_original
+
+ subject
+ end
+ end
+
+ it 'executes the revoke service' do
+ spy_service = X509CertificateRevokeService.new
+
+ allow(X509CertificateRevokeService).to receive(:new) { spy_service }
+
+ expect_next_instance_of(X509CertificateRevokeService) do |service|
+ expect(service).to receive(:execute).with(x509_certificate)
+ end
+
+ subject
+ end
+ end
+ end
+end