diff options
Diffstat (limited to 'spec/workers/deployments')
-rw-r--r-- | spec/workers/deployments/finished_worker_spec.rb | 65 | ||||
-rw-r--r-- | spec/workers/deployments/hooks_worker_spec.rb | 1 | ||||
-rw-r--r-- | spec/workers/deployments/success_worker_spec.rb | 38 |
3 files changed, 0 insertions, 104 deletions
diff --git a/spec/workers/deployments/finished_worker_spec.rb b/spec/workers/deployments/finished_worker_spec.rb deleted file mode 100644 index d0a26ae1547..00000000000 --- a/spec/workers/deployments/finished_worker_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Deployments::FinishedWorker do - let(:worker) { described_class.new } - - describe '#perform' do - before do - allow(ProjectServiceWorker).to receive(:perform_async) - end - - it 'links merge requests to the deployment' do - deployment = create(:deployment) - service = instance_double(Deployments::LinkMergeRequestsService) - - expect(Deployments::LinkMergeRequestsService) - .to receive(:new) - .with(deployment) - .and_return(service) - - expect(service).to receive(:execute) - - worker.perform(deployment.id) - end - - it 'executes project services for deployment_hooks' do - deployment = create(:deployment) - project = deployment.project - service = create(:service, type: 'SlackService', project: project, deployment_events: true, active: true) - - worker.perform(deployment.id) - - expect(ProjectServiceWorker).to have_received(:perform_async).with(service.id, an_instance_of(Hash)) - end - - it 'does not execute an inactive service' do - deployment = create(:deployment) - project = deployment.project - create(:service, type: 'SlackService', project: project, deployment_events: true, active: false) - - worker.perform(deployment.id) - - expect(ProjectServiceWorker).not_to have_received(:perform_async) - end - - it 'does nothing if a deployment with the given id does not exist' do - worker.perform(0) - - expect(ProjectServiceWorker).not_to have_received(:perform_async) - end - - it 'execute webhooks' do - deployment = create(:deployment) - project = deployment.project - web_hook = create(:project_hook, deployment_events: true, project: project) - - expect_next_instance_of(WebHookService, web_hook, an_instance_of(Hash), "deployment_hooks") do |service| - expect(service).to receive(:async_execute) - end - - worker.perform(deployment.id) - end - end -end diff --git a/spec/workers/deployments/hooks_worker_spec.rb b/spec/workers/deployments/hooks_worker_spec.rb index 5d8edf85dd9..b4a91cff2ac 100644 --- a/spec/workers/deployments/hooks_worker_spec.rb +++ b/spec/workers/deployments/hooks_worker_spec.rb @@ -52,7 +52,6 @@ RSpec.describe Deployments::HooksWorker do it_behaves_like 'worker with data consistency', described_class, - feature_flag: :load_balancing_for_deployments_hooks_worker, data_consistency: :delayed end end diff --git a/spec/workers/deployments/success_worker_spec.rb b/spec/workers/deployments/success_worker_spec.rb deleted file mode 100644 index d9996e66919..00000000000 --- a/spec/workers/deployments/success_worker_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Deployments::SuccessWorker do - subject { described_class.new.perform(deployment&.id) } - - context 'when successful deployment' do - let(:deployment) { create(:deployment, :success) } - - it 'executes Deployments::UpdateEnvironmentService' do - expect(Deployments::UpdateEnvironmentService) - .to receive(:new).with(deployment).and_call_original - - subject - end - end - - context 'when canceled deployment' do - let(:deployment) { create(:deployment, :canceled) } - - it 'does not execute Deployments::UpdateEnvironmentService' do - expect(Deployments::UpdateEnvironmentService).not_to receive(:new) - - subject - end - end - - context 'when deploy record does not exist' do - let(:deployment) { nil } - - it 'does not execute Deployments::UpdateEnvironmentService' do - expect(Deployments::UpdateEnvironmentService).not_to receive(:new) - - subject - end - end -end |