blob: 0a6a3d82ee0e3c933a65dad6c5b824a275e137f4 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Merge request > User sees draft help message' do
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
before do
project.add_maintainer(user)
sign_in(user)
end
context 'with draft commits' do
it 'shows a specific draft hint' do
visit project_new_merge_request_path(
project,
merge_request: {
source_project_id: project.id,
target_project_id: project.id,
source_branch: 'wip',
target_branch: 'master'
})
within_wip_explanation do
expect(page).to have_text(
'It looks like you have some draft commits in this branch'
)
end
end
end
context 'without draft commits' do
it 'shows the regular draft message' do
visit project_new_merge_request_path(
project,
merge_request: {
source_project_id: project.id,
target_project_id: project.id,
source_branch: 'fix',
target_branch: 'master'
})
within_wip_explanation do
expect(page).not_to have_text(
'It looks like you have some draft commits in this branch'
)
expect(page).to have_text(
"Start the title with Draft: to prevent a merge request that is a \
work in progress from being merged before it's ready."
)
end
end
end
def within_wip_explanation(&block)
page.within '.js-no-wip-explanation' do
yield
end
end
end
|