diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/services/bulk_update_integration_service_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/services/bulk_update_integration_service_spec.rb')
-rw-r--r-- | spec/services/bulk_update_integration_service_spec.rb | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/spec/services/bulk_update_integration_service_spec.rb b/spec/services/bulk_update_integration_service_spec.rb index c10a9b75648..5e521b98482 100644 --- a/spec/services/bulk_update_integration_service_spec.rb +++ b/spec/services/bulk_update_integration_service_spec.rb @@ -16,32 +16,19 @@ RSpec.describe BulkUpdateIntegrationService do let_it_be(:group) { create(:group) } let_it_be(:subgroup) { create(:group, parent: group) } - let_it_be(:group_integration) do - Integrations::Jira.create!( - group: group, - url: 'http://group.jira.com' - ) - end - + let_it_be(:group_integration) { create(:jira_integration, :group, group: group, url: 'http://group.jira.com') } + let_it_be(:excluded_integration) { create(:jira_integration, :group, group: create(:group), url: 'http://another.jira.com', push_events: false) } let_it_be(:subgroup_integration) do - Integrations::Jira.create!( - inherit_from_id: group_integration.id, + create(:jira_integration, :group, group: subgroup, + inherit_from_id: group_integration.id, url: 'http://subgroup.jira.com', push_events: true ) end - let_it_be(:excluded_integration) do - Integrations::Jira.create!( - group: create(:group), - url: 'http://another.jira.com', - push_events: false - ) - end - let_it_be(:integration) do - Integrations::Jira.create!( + create(:jira_integration, project: create(:project, group: subgroup), inherit_from_id: subgroup_integration.id, url: 'http://project.jira.com', @@ -88,4 +75,22 @@ RSpec.describe BulkUpdateIntegrationService do described_class.new(group_integration, [integration]).execute end.to change { integration.reload.url }.to(group_integration.url) end + + context 'with different foreign key of data_fields' do + let(:integration) { create(:zentao_integration, project: create(:project, group: group)) } + let(:group_integration) do + create(:zentao_integration, :group, + group: group, + url: 'https://group.zentao.net', + api_token: 'GROUP_TOKEN', + zentao_product_xid: '1' + ) + end + + it 'works with batch as an array of ActiveRecord objects' do + expect do + described_class.new(group_integration, [integration]).execute + end.to change { integration.reload.url }.to(group_integration.url) + end + end end |