blob: 0f8ab4cd92bc3426e90c3c6addde71323ae090ab (
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
|
require 'spec_helper'
feature 'Check if mergeable with unresolved discussions', js: true, feature: true do
let(:user) { create(:user) }
let(:project) { create(:project) }
let!(:merge_request) { create(:merge_request_with_diff_notes, source_project: project, author: user) }
before do
gitlab_sign_in user
project.team << [user, :master]
end
context 'when project.only_allow_merge_if_all_discussions_are_resolved == true' do
before do
project.update_column(:only_allow_merge_if_all_discussions_are_resolved, true)
end
context 'with unresolved discussions' do
it 'does not allow to merge' do
visit_merge_request(merge_request)
expect(page).not_to have_button 'Merge'
expect(page).to have_content('There are unresolved discussions.')
end
end
context 'with all discussions resolved' do
before do
merge_request.discussions.each { |d| d.resolve!(user) }
end
it 'allows MR to be merged' do
visit_merge_request(merge_request)
expect(page).to have_button 'Merge'
end
end
end
context 'when project.only_allow_merge_if_all_discussions_are_resolved == false' do
before do
project.update_column(:only_allow_merge_if_all_discussions_are_resolved, false)
end
context 'with unresolved discussions' do
it 'does not allow to merge' do
visit_merge_request(merge_request)
expect(page).to have_button 'Merge'
end
end
context 'with all discussions resolved' do
before do
merge_request.discussions.each { |d| d.resolve!(user) }
end
it 'allows MR to be merged' do
visit_merge_request(merge_request)
expect(page).to have_button 'Merge'
end
end
end
def visit_merge_request(merge_request)
visit project_merge_request_path(merge_request.project, merge_request)
end
end
|