Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-29 00:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-29 00:08:42 +0300
commit669f67690a43e9ec7b6d148c6ec1391b379fa16e (patch)
treec9fd1ad2e0748a959a24fe292bfe4c764797e421 /spec/services/bulk_update_integration_service_spec.rb
parent3e49ae159acbb703f005f5014772072cd90ef97b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/bulk_update_integration_service_spec.rb')
-rw-r--r--spec/services/bulk_update_integration_service_spec.rb57
1 files changed, 33 insertions, 24 deletions
diff --git a/spec/services/bulk_update_integration_service_spec.rb b/spec/services/bulk_update_integration_service_spec.rb
index d6022ba5b59..e7944f07bb7 100644
--- a/spec/services/bulk_update_integration_service_spec.rb
+++ b/spec/services/bulk_update_integration_service_spec.rb
@@ -10,60 +10,69 @@ RSpec.describe BulkUpdateIntegrationService do
end
let(:excluded_attributes) { %w[id project_id group_id inherit_from_id instance template created_at updated_at] }
+ let(:batch) do
+ Service.inherited_descendants_from_self_or_ancestors_from(subgroup_integration).where(id: group_integration.id..integration.id)
+ end
let_it_be(:group) { create(:group) }
+ let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:group_integration) do
JiraService.create!(
group: group,
- active: true,
- push_events: true,
- url: 'http://update-jira.instance.com',
- username: 'user',
- password: 'secret'
+ url: 'http://group.jira.com'
)
end
let_it_be(:subgroup_integration) do
JiraService.create!(
inherit_from_id: group_integration.id,
- group: create(:group, parent: group),
- active: true,
- push_events: true,
- url: 'http://update-jira.instance.com',
- username: 'user',
- password: 'secret'
+ group: subgroup,
+ url: 'http://subgroup.jira.com',
+ push_events: true
+ )
+ end
+
+ let_it_be(:excluded_integration) do
+ JiraService.create!(
+ group: create(:group),
+ url: 'http://another.jira.com',
+ push_events: false
)
end
let_it_be(:integration) do
JiraService.create!(
- project: create(:project),
- instance: false,
- active: true,
- push_events: false,
- url: 'http://jira.instance.com',
- username: 'user',
- password: 'secret'
+ project: create(:project, group: subgroup),
+ inherit_from_id: subgroup_integration.id,
+ url: 'http://project.jira.com',
+ push_events: false
)
end
context 'with inherited integration' do
- it 'updates the integration' do
- described_class.new(subgroup_integration, Service.where.not(project: nil)).execute
+ it 'updates the integration', :aggregate_failures do
+ described_class.new(subgroup_integration, batch).execute
expect(integration.reload.inherit_from_id).to eq(group_integration.id)
- expect(integration.attributes.except(*excluded_attributes))
+ expect(integration.reload.attributes.except(*excluded_attributes))
.to eq(subgroup_integration.attributes.except(*excluded_attributes))
+
+ expect(excluded_integration.reload.inherit_from_id).not_to eq(group_integration.id)
+ expect(excluded_integration.reload.attributes.except(*excluded_attributes))
+ .not_to eq(subgroup_integration.attributes.except(*excluded_attributes))
end
context 'with integration with data fields' do
let(:excluded_attributes) { %w[id service_id created_at updated_at] }
- it 'updates the data fields from the integration' do
- described_class.new(subgroup_integration, Service.where.not(project: nil)).execute
+ it 'updates the data fields from the integration', :aggregate_failures do
+ described_class.new(subgroup_integration, batch).execute
- expect(integration.reload.data_fields.attributes.except(*excluded_attributes))
+ expect(integration.data_fields.attributes.except(*excluded_attributes))
.to eq(subgroup_integration.data_fields.attributes.except(*excluded_attributes))
+
+ expect(integration.data_fields.attributes.except(*excluded_attributes))
+ .not_to eq(excluded_integration.data_fields.attributes.except(*excluded_attributes))
end
end
end