summaryrefslogtreecommitdiff
path: root/spec/workers/jira_connect/send_uninstalled_hook_worker_spec.rb
blob: d8ca8dee54d08f04cbc74841ca1161a153eba8ff (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
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe JiraConnect::SendUninstalledHookWorker, feature_category: :integrations do
  describe '#perform' do
    let_it_be(:jira_connect_installation) { create(:jira_connect_installation) }
    let(:instance_url) { 'http://example.com' }
    let(:attempts) { 3 }
    let(:service_response) { ServiceResponse.new(status: :success) }
    let(:job_args) { [jira_connect_installation.id, instance_url] }

    before do
      allow(JiraConnectInstallations::ProxyLifecycleEventService).to receive(:execute).and_return(service_response)
    end

    include_examples 'an idempotent worker' do
      it 'calls the ProxyLifecycleEventService service' do
        expect(JiraConnectInstallations::ProxyLifecycleEventService).to receive(:execute).with(
          jira_connect_installation,
          :uninstalled,
          instance_url
        ).twice

        subject
      end
    end
  end
end