diff options
Diffstat (limited to 'spec/workers/propagate_integration_inherit_descendant_worker_spec.rb')
-rw-r--r-- | spec/workers/propagate_integration_inherit_descendant_worker_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb b/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb new file mode 100644 index 00000000000..b5eb0f69017 --- /dev/null +++ b/spec/workers/propagate_integration_inherit_descendant_worker_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe PropagateIntegrationInheritDescendantWorker do + let_it_be(:group) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: group) } + let_it_be(:group_integration) { create(:redmine_service, group: group, project: nil) } + let_it_be(:subgroup_integration) { create(:redmine_service, group: subgroup, project: nil, inherit_from_id: group_integration.id) } + + it_behaves_like 'an idempotent worker' do + let(:job_args) { [group_integration.id, subgroup_integration.id, subgroup_integration.id] } + + it 'calls to BulkUpdateIntegrationService' do + expect(BulkUpdateIntegrationService).to receive(:new) + .with(group_integration, match_array(subgroup_integration)).twice + .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, subgroup_integration.id, subgroup_integration.id) + end + end +end |