2020-09-29 15:10:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe PropagateIntegrationInheritWorker do
|
|
|
|
describe '#perform' do
|
|
|
|
let_it_be(:integration) { create(:redmine_service, :instance) }
|
|
|
|
let_it_be(:integration1) { create(:redmine_service, inherit_from_id: integration.id) }
|
2021-06-09 18:11:25 +00:00
|
|
|
let_it_be(:integration2) { create(:bugzilla_integration, inherit_from_id: integration.id) }
|
2020-09-29 15:10:08 +00:00
|
|
|
let_it_be(:integration3) { create(:redmine_service) }
|
|
|
|
|
|
|
|
it_behaves_like 'an idempotent worker' do
|
|
|
|
let(:job_args) { [integration.id, integration1.id, integration3.id] }
|
|
|
|
|
2020-10-23 18:08:31 +00:00
|
|
|
it 'calls to BulkUpdateIntegrationService' do
|
2020-09-29 15:10:08 +00:00
|
|
|
expect(BulkUpdateIntegrationService).to receive(:new)
|
2020-10-07 00:08:24 +00:00
|
|
|
.with(integration, match_array(integration1)).twice
|
2020-09-29 15:10:08 +00:00
|
|
|
.and_return(double(execute: nil))
|
|
|
|
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with an invalid integration id' do
|
|
|
|
it 'returns without failure' do
|
|
|
|
expect(BulkUpdateIntegrationService).not_to receive(:new)
|
|
|
|
|
|
|
|
subject.perform(0, integration1.id, integration3.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|