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>2023-02-20 16:49:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-20 16:49:51 +0300
commit71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch)
tree6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/models/integrations
parenta7253423e3403b8c08f8a161e5937e1488f5f407 (diff)
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/models/integrations')
-rw-r--r--spec/models/integrations/base_chat_notification_spec.rb30
-rw-r--r--spec/models/integrations/issue_tracker_data_spec.rb2
-rw-r--r--spec/models/integrations/jira_tracker_data_spec.rb2
-rw-r--r--spec/models/integrations/microsoft_teams_spec.rb4
-rw-r--r--spec/models/integrations/mock_ci_spec.rb4
-rw-r--r--spec/models/integrations/zentao_tracker_data_spec.rb2
6 files changed, 34 insertions, 10 deletions
diff --git a/spec/models/integrations/base_chat_notification_spec.rb b/spec/models/integrations/base_chat_notification_spec.rb
index 1527ffd7278..13dd9e03ab1 100644
--- a/spec/models/integrations/base_chat_notification_spec.rb
+++ b/spec/models/integrations/base_chat_notification_spec.rb
@@ -9,13 +9,33 @@ RSpec.describe Integrations::BaseChatNotification, feature_category: :integratio
describe 'validations' do
before do
- allow(subject).to receive(:activated?).and_return(true)
+ subject.active = active
+
allow(subject).to receive(:default_channel_placeholder).and_return('placeholder')
allow(subject).to receive(:webhook_help).and_return('help')
end
- it { is_expected.to validate_presence_of :webhook }
- it { is_expected.to validate_inclusion_of(:labels_to_be_notified_behavior).in_array(%w[match_any match_all]).allow_blank }
+ def build_channel_list(count)
+ (1..count).map { |i| "##{i}" }.join(',')
+ end
+
+ context 'when active' do
+ let(:active) { true }
+
+ it { is_expected.to validate_presence_of :webhook }
+ it { is_expected.to validate_inclusion_of(:labels_to_be_notified_behavior).in_array(%w[match_any match_all]).allow_blank }
+ it { is_expected.to allow_value(build_channel_list(10)).for(:push_channel) }
+ it { is_expected.not_to allow_value(build_channel_list(11)).for(:push_channel) }
+ end
+
+ context 'when inactive' do
+ let(:active) { false }
+
+ it { is_expected.not_to validate_presence_of :webhook }
+ it { is_expected.not_to validate_inclusion_of(:labels_to_be_notified_behavior).in_array(%w[match_any match_all]).allow_blank }
+ it { is_expected.to allow_value(build_channel_list(10)).for(:push_channel) }
+ it { is_expected.to allow_value(build_channel_list(11)).for(:push_channel) }
+ end
end
describe '#execute' do
@@ -309,6 +329,10 @@ RSpec.describe Integrations::BaseChatNotification, feature_category: :integratio
context 'with multiple channel names with spaces specified' do
it_behaves_like 'with channel specified', 'slack-integration, #slack-test, @UDLP91W0A', ['slack-integration', '#slack-test', '@UDLP91W0A']
end
+
+ context 'with duplicate channel names' do
+ it_behaves_like 'with channel specified', '#slack-test,#slack-test,#slack-test-2', ['#slack-test', '#slack-test-2']
+ end
end
describe '#default_channel_placeholder' do
diff --git a/spec/models/integrations/issue_tracker_data_spec.rb b/spec/models/integrations/issue_tracker_data_spec.rb
index 233ed7b8475..285e41424c7 100644
--- a/spec/models/integrations/issue_tracker_data_spec.rb
+++ b/spec/models/integrations/issue_tracker_data_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe Integrations::IssueTrackerData do
it_behaves_like Integrations::BaseDataFields
describe 'encrypted attributes' do
- subject { described_class.encrypted_attributes.keys }
+ subject { described_class.attr_encrypted_attributes.keys }
it { is_expected.to contain_exactly(:issues_url, :new_issue_url, :project_url) }
end
diff --git a/spec/models/integrations/jira_tracker_data_spec.rb b/spec/models/integrations/jira_tracker_data_spec.rb
index d9f91527fbb..68aa30f06ed 100644
--- a/spec/models/integrations/jira_tracker_data_spec.rb
+++ b/spec/models/integrations/jira_tracker_data_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Integrations::JiraTrackerData do
end
describe 'encrypted attributes' do
- subject { described_class.encrypted_attributes.keys }
+ subject { described_class.attr_encrypted_attributes.keys }
it { is_expected.to contain_exactly(:api_url, :password, :url, :username) }
end
diff --git a/spec/models/integrations/microsoft_teams_spec.rb b/spec/models/integrations/microsoft_teams_spec.rb
index c61cc732372..4d5f4065420 100644
--- a/spec/models/integrations/microsoft_teams_spec.rb
+++ b/spec/models/integrations/microsoft_teams_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe Integrations::MicrosoftTeams do
context 'with issue events' do
let(:opts) { { title: 'Awesome issue', description: 'please fix' } }
let(:issues_sample_data) do
- service = Issues::CreateService.new(project: project, current_user: user, params: opts, spam_params: nil)
+ service = Issues::CreateService.new(container: project, current_user: user, params: opts, spam_params: nil)
issue = service.execute[:issue]
service.hook_data(issue, 'open')
end
@@ -194,7 +194,7 @@ RSpec.describe Integrations::MicrosoftTeams do
end
describe 'Pipeline events' do
- let_it_be_with_reload(:project) { create(:project, :repository) }
+ let_it_be_with_refind(:project) { create(:project, :repository) }
let(:pipeline) do
create(:ci_pipeline,
diff --git a/spec/models/integrations/mock_ci_spec.rb b/spec/models/integrations/mock_ci_spec.rb
index 83954812bfe..3ff47ab2f0b 100644
--- a/spec/models/integrations/mock_ci_spec.rb
+++ b/spec/models/integrations/mock_ci_spec.rb
@@ -14,8 +14,8 @@ RSpec.describe Integrations::MockCi do
describe '#commit_status' do
let(:sha) { generate(:sha) }
- def stub_request(*args)
- WebMock.stub_request(:get, integration.commit_status_path(sha)).to_return(*args)
+ def stub_request(...)
+ WebMock.stub_request(:get, integration.commit_status_path(sha)).to_return(...)
end
def commit_status
diff --git a/spec/models/integrations/zentao_tracker_data_spec.rb b/spec/models/integrations/zentao_tracker_data_spec.rb
index dca5c4d79ae..38f2fb1b3f3 100644
--- a/spec/models/integrations/zentao_tracker_data_spec.rb
+++ b/spec/models/integrations/zentao_tracker_data_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Integrations::ZentaoTrackerData do
end
describe 'encrypted attributes' do
- subject { described_class.encrypted_attributes.keys }
+ subject { described_class.attr_encrypted_attributes.keys }
it { is_expected.to contain_exactly(:url, :api_url, :zentao_product_xid, :api_token) }
end