1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe JiraConnect::AppDescriptorController, feature_category: :integrations do
describe '#show' do
let(:descriptor) do
json_response.deep_symbolize_keys
end
let(:logo_url) { %r{\Ahttp://test\.host/assets/gitlab_logo-\h+\.png\z} }
let(:common_module_properties) do
{
homeUrl: 'https://gitlab.com',
logoUrl: logo_url,
documentationUrl: 'https://docs.gitlab.com/ee/integration/jira/'
}
end
it 'returns JSON app descriptor' do
get :show
expect(response).to have_gitlab_http_status(:ok)
expect(descriptor).to include(
name: Atlassian::JiraConnect.app_name,
description: kind_of(String),
key: Atlassian::JiraConnect.app_key,
baseUrl: 'https://test.host/-/jira_connect',
lifecycle: {
installed: '/events/installed',
uninstalled: '/events/uninstalled'
},
vendor: {
name: 'GitLab',
url: 'https://gitlab.com'
},
links: {
documentation: 'http://test.host/help/integration/jira_development_panel#gitlabcom-1',
feedback: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413652'
},
authentication: {
type: 'jwt'
},
scopes: %w(READ WRITE DELETE),
apiVersion: 1,
apiMigrations: {
'context-qsh': true,
gdpr: true,
'signed-install': true
}
)
expect(descriptor[:modules]).to include(
postInstallPage: {
key: 'gitlab-configuration',
name: { value: 'GitLab Configuration' },
url: '/subscriptions',
conditions: contain_exactly(
a_hash_including(condition: 'user_is_admin', invert: false)
)
},
jiraDevelopmentTool: {
actions: {
createBranch: {
templateUrl: 'http://test.host/-/jira_connect/branches/new?issue_key={issue.key}&issue_summary={issue.summary}'
}
},
key: 'gitlab-development-tool',
application: { value: 'GitLab' },
name: { value: 'GitLab' },
url: 'https://gitlab.com',
logoUrl: logo_url,
capabilities: %w(branch commit pull_request)
},
jiraBuildInfoProvider: common_module_properties.merge(
actions: {},
name: { value: 'GitLab CI' },
key: 'gitlab-ci'
),
jiraDeploymentInfoProvider: common_module_properties.merge(
actions: {},
name: { value: 'GitLab Deployments' },
key: 'gitlab-deployments'
),
jiraFeatureFlagInfoProvider: common_module_properties.merge(
actions: {},
name: { value: 'GitLab Feature Flags' },
key: 'gitlab-feature-flags'
)
)
end
context 'when feature flag jira_for_cloud_app_feedback_link is disabled' do
before do
stub_feature_flags(jira_for_cloud_app_feedback_link: false)
end
it 'does not include the feedback link' do
get :show
expect(descriptor[:links]).not_to include(
feedback: 'https://gitlab.com/gitlab-org/gitlab/-/issues/413652'
)
end
end
end
end
|