blob: 4c08d1e6e659fca0c56d738627b89bea8eae70f8 (
plain)
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
|
require 'spec_helper'
feature 'Setup Mattermost slash commands', feature: true do
include WaitForAjax
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:service) { project.create_mattermost_slash_commands_service }
before do
project.team << [user, :master]
login_as(user)
visit edit_namespace_project_service_path(project.namespace, project, service)
end
describe 'user visits the mattermost slash command config page', js: true do
it 'shows a help message' do
wait_for_ajax
expect(page).to have_content("This service allows GitLab users to perform common")
end
it 'shows the token after saving' do
token = ('a'..'z').to_a.join
fill_in 'service_token', with: token
click_on 'Save'
value = find_field('service_token').value
expect(value).to eq(token)
end
describe 'mattermost service is enabled' do
let(:info) { find('.services-installation-info') }
before do
Gitlab.config.mattermost.enabled = true
end
it 'shows the correct mattermost url' do
expect(page).to have_content Gitlab.config.mattermost.host
end
describe 'mattermost service is active' do
before do
service.active = true
end
it 'shows that mattermost is active' do
expect(info).to have_content 'Installed'
expect(info).not_to have_content 'Not installed'
end
it 'shows the edit mattermost button' do
expect(info).to have_button 'Edit Mattermost'
end
end
describe 'mattermost service is not active' do
before do
service.active = false
end
it 'shows that mattermost is not active' do
expect(info).to have_content 'Not installed'
end
it 'shows the add to mattermost button' do
expect(info).to have_button 'Add to Mattermost'
end
end
end
describe 'mattermost service is not enabled' do
before do
Gitlab.config.mattermost.enabled = false
end
it 'shows the correct trigger url' do
value = find_field('request_url').value
expect(value).to match("api/v3/projects/#{project.id}/services/mattermost_slash_commands/trigger")
end
end
end
end
|