summaryrefslogtreecommitdiff
path: root/spec/workers/deployments/success_worker_spec.rb
blob: 91e323f202b49f1fba031b51b453b2f7de91e5fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'spec_helper'

describe Deployments::SuccessWorker do
  subject { described_class.new.perform(deployment&.id) }

  context 'when deploy record exists' do
    let(:deployment) { create(:deployment) }

    it 'executes UpdateDeploymentService' do
      expect(UpdateDeploymentService)
        .to receive(:new).with(deployment).and_call_original

      subject
    end
  end

  context 'when deploy record does not exist' do
    let(:deployment) { nil }

    it 'executes UpdateDeploymentService' do
      expect(UpdateDeploymentService).not_to receive(:new)

      subject
    end
  end
end