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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Project > User views empty wiki' do
let_it_be(:user) { create(:user) }
let(:wiki) { create(:project_wiki, project: project) }
it_behaves_like 'User views empty wiki' do
context 'when project is public' do
let(:project) { create(:project, :public) }
it_behaves_like 'empty wiki message', issuable: true
context 'when issue tracker is private' do
let(:project) { create(:project, :public, :issues_private) }
it_behaves_like 'empty wiki message', issuable: false
end
context 'when issue tracker is disabled' do
let(:project) { create(:project, :public, :issues_disabled) }
it_behaves_like 'empty wiki message', issuable: false
end
context 'and user is logged in' do
before do
sign_in(user)
end
context 'and user is not a member' do
it_behaves_like 'empty wiki message', issuable: true
end
context 'and user is a member' do
before do
project.add_developer(user)
end
it_behaves_like 'empty wiki message', writable: true, issuable: true
end
end
end
context 'when project is private' do
let(:project) { create(:project, :private) }
it_behaves_like 'wiki is not found'
context 'and user is logged in' do
before do
sign_in(user)
end
context 'and user is not a member' do
it_behaves_like 'wiki is not found'
end
context 'and user is a member' do
before do
project.add_developer(user)
end
it_behaves_like 'empty wiki message', writable: true, issuable: true
end
context 'and user is a maintainer' do
before do
project.add_maintainer(user)
end
it_behaves_like 'empty wiki message', writable: true, issuable: true, confluence: true
context 'and Confluence is already enabled' do
before do
create(:confluence_service, project: project)
end
it_behaves_like 'empty wiki message', writable: true, issuable: true, confluence: false
end
end
end
end
end
end
|