Skip to content
代码片段 群组 项目
未验证 提交 63b44dc6 编辑于 作者: Bojan Marjanovic's avatar Bojan Marjanovic 提交者: GitLab
浏览文件

Add specs for integrations_helpers

上级 5fe8dea3
No related branches found
No related tags found
无相关合并请求
......@@ -8,9 +8,11 @@ class SlackSlashCommands < BaseSlashCommands
field :token,
type: :password,
description: -> { _('The Slack token.') },
non_empty_password_title: -> { s_('ProjectService|Enter new token') },
non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current token.') },
placeholder: ''
placeholder: '',
required: true
def self.title
'Slack slash commands'
......
......@@ -30,20 +30,8 @@ class Integrations < ::API::Base
end
SLASH_COMMAND_INTEGRATIONS = {
'mattermost-slash-commands' => [
{
name: :token,
type: String,
desc: 'The Mattermost token'
}
],
'slack-slash-commands' => [
{
name: :token,
type: String,
desc: 'The Slack token'
}
]
'mattermost-slash-commands' => ::Integrations::MattermostSlashCommands.api_fields,
'slack-slash-commands' => ::Integrations::SlackSlashCommands.api_fields
}.freeze
helpers do
......
......@@ -49471,6 +49471,9 @@ msgstr ""
msgid "The Slack notifications integration is deprecated and will be removed in a future release. To continue to receive notifications from Slack, use the GitLab for Slack app instead. %{learn_more_link_start}Learn more%{link_end}."
msgstr ""
 
msgid "The Slack token."
msgstr ""
msgid "The Snowplow cookie domain."
msgstr ""
 
# frozen_string_literal: true
require "spec_helper"
RSpec.describe API::Helpers::IntegrationsHelpers, feature_category: :integrations do
let(:base_classes) { Integration::BASE_CLASSES.map(&:constantize) }
let(:development_classes) { [Integrations::MockCi, Integrations::MockMonitoring] }
let(:instance_level_classes) { [Integrations::BeyondIdentity] }
describe '.chat_notification_flags' do
it 'returns correct values' do
expect(described_class.chat_notification_flags).to match_array(
[
{
required: false,
name: :notify_only_broken_pipelines,
type: ::Grape::API::Boolean,
desc: 'Send notifications for broken pipelines'
}
]
)
end
end
describe '.integrations' do
it 'has correct integrations' do
expect(described_class.integrations.keys.map(&:underscore))
.to match_array(described_class.integration_classes.map(&:to_param))
end
end
describe '.integration_classes' do
it 'returns correct integrations' do
expect(described_class.integration_classes)
.to match_array(Integration.descendants.without(base_classes, development_classes, instance_level_classes))
end
end
describe '.development_integration_classes' do
it 'returns correct integrations' do
expect(described_class.development_integration_classes).to eq(development_classes)
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册