blob: 1a7bfc5b5cd7e2d5f0980ccf9030eb5e8b406363 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'projects/settings/merge_requests/show' do
include Devise::Test::ControllerHelpers
include ProjectForksHelper
let(:project) { create(:project) }
let(:user) { create(:admin) }
before do
assign(:project, project)
allow(controller).to receive(:current_user).and_return(user)
allow(view).to receive_messages(
current_user: user,
can?: true,
current_application_settings: Gitlab::CurrentSettings.current_application_settings
)
end
describe 'merge suggestions settings' do
it 'displays a placeholder if none is set' do
render
placeholder = "Apply %{suggestions_count} suggestion(s) to %{files_count} file(s)"
expect(rendered).to have_field('project[suggestion_commit_message]', placeholder: placeholder)
end
it 'displays the user entered value' do
project.update!(suggestion_commit_message: 'refactor: changed %{file_paths}')
render
expect(rendered).to have_field('project[suggestion_commit_message]', with: 'refactor: changed %{file_paths}')
end
end
describe 'merge commit template' do
it 'displays default template if none is set' do
render
expect(rendered).to have_field('project[merge_commit_template_or_default]', with: <<~MSG.rstrip)
Merge branch '%{source_branch}' into '%{target_branch}'
%{title}
%{issues}
See merge request %{reference}
MSG
end
it 'displays the user entered value' do
project.update!(merge_commit_template: '%{title}')
render
expect(rendered).to have_field('project[merge_commit_template_or_default]', with: '%{title}')
end
end
describe 'squash template' do
it 'displays default template if none is set' do
render
expect(rendered).to have_field('project[squash_commit_template_or_default]', with: '%{title}')
end
it 'displays the user entered value' do
project.update!(squash_commit_template: '%{first_multiline_commit}')
render
expect(rendered).to have_field('project[squash_commit_template_or_default]', with: '%{first_multiline_commit}')
end
end
end
|