debian-mirror-gitlab/spec/workers/deployments/success_worker_spec.rb

39 lines
977 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2018-12-13 13:39:08 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Deployments::SuccessWorker do
2018-12-13 13:39:08 +05:30
subject { described_class.new.perform(deployment&.id) }
context 'when successful deployment' do
let(:deployment) { create(:deployment, :success) }
2021-01-03 14:25:43 +05:30
it 'executes Deployments::UpdateEnvironmentService' do
expect(Deployments::UpdateEnvironmentService)
2018-12-13 13:39:08 +05:30
.to receive(:new).with(deployment).and_call_original
subject
end
end
context 'when canceled deployment' do
let(:deployment) { create(:deployment, :canceled) }
2021-01-03 14:25:43 +05:30
it 'does not execute Deployments::UpdateEnvironmentService' do
expect(Deployments::UpdateEnvironmentService).not_to receive(:new)
2018-12-13 13:39:08 +05:30
subject
end
end
context 'when deploy record does not exist' do
let(:deployment) { nil }
2021-01-03 14:25:43 +05:30
it 'does not execute Deployments::UpdateEnvironmentService' do
expect(Deployments::UpdateEnvironmentService).not_to receive(:new)
2018-12-13 13:39:08 +05:30
subject
end
end
end