diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-07 03:08:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-07 03:08:24 +0300 |
commit | 967b999f2ee84d76a2c4d9618a6fe542a0dc1fb8 (patch) | |
tree | cf9512d03056beea678cda109a7e7aa8866d7375 /spec/workers/propagate_integration_group_worker_spec.rb | |
parent | 069267811015e9f119326dfc47ecc13f9e47681a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/propagate_integration_group_worker_spec.rb')
-rw-r--r-- | spec/workers/propagate_integration_group_worker_spec.rb | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/spec/workers/propagate_integration_group_worker_spec.rb b/spec/workers/propagate_integration_group_worker_spec.rb index b3c9255db57..fbf1fbf1fea 100644 --- a/spec/workers/propagate_integration_group_worker_spec.rb +++ b/spec/workers/propagate_integration_group_worker_spec.rb @@ -4,33 +4,40 @@ require 'spec_helper' RSpec.describe PropagateIntegrationGroupWorker do describe '#perform' do - let_it_be(:group1) { create(:group) } - let_it_be(:group2) { create(:group) } + let_it_be(:group) { create(:group) } + let_it_be(:another_group) { create(:group) } + let_it_be(:subgroup1) { create(:group, parent: group) } + let_it_be(:subgroup2) { create(:group, parent: group) } let_it_be(:integration) { create(:redmine_service, :instance) } - - before do - allow(BulkCreateIntegrationService).to receive(:new) - .with(integration, match_array([group1, group2]), 'group') - .and_return(double(execute: nil)) - end + let(:job_args) { [integration.id, group.id, subgroup2.id] } it_behaves_like 'an idempotent worker' do - let(:job_args) { [integration.id, group1.id, group2.id] } - it 'calls to BulkCreateIntegrationService' do expect(BulkCreateIntegrationService).to receive(:new) - .with(integration, match_array([group1, group2]), 'group') + .with(integration, match_array([group, another_group, subgroup1, subgroup2]), 'group').twice .and_return(double(execute: nil)) subject end + + context 'with a group integration' do + let_it_be(:integration) { create(:redmine_service, group: group, project: nil) } + + it 'calls to BulkCreateIntegrationService' do + expect(BulkCreateIntegrationService).to receive(:new) + .with(integration, match_array([subgroup1, subgroup2]), 'group').twice + .and_return(double(execute: nil)) + + subject + end + end end context 'with an invalid integration id' do it 'returns without failure' do expect(BulkCreateIntegrationService).not_to receive(:new) - subject.perform(0, group1.id, group2.id) + subject.perform(0, 1, 100) end end end |