2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
RSpec.describe 'Merge request > User sees draft help message' do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:user) { project.creator }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
context 'with draft commits' do
|
|
|
|
it 'shows a specific draft hint' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_new_merge_request_path(
|
2017-08-17 22:00:37 +05:30
|
|
|
project,
|
|
|
|
merge_request: {
|
|
|
|
source_project_id: project.id,
|
|
|
|
target_project_id: project.id,
|
|
|
|
source_branch: 'wip',
|
|
|
|
target_branch: 'master'
|
2017-09-10 17:25:29 +05:30
|
|
|
})
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
within_wip_explanation do
|
|
|
|
expect(page).to have_text(
|
2020-10-24 23:57:45 +05:30
|
|
|
'It looks like you have some draft commits in this branch'
|
2017-08-17 22:00:37 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
context 'without draft commits' do
|
|
|
|
it 'shows the regular draft message' do
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_new_merge_request_path(
|
2017-08-17 22:00:37 +05:30
|
|
|
project,
|
|
|
|
merge_request: {
|
|
|
|
source_project_id: project.id,
|
|
|
|
target_project_id: project.id,
|
|
|
|
source_branch: 'fix',
|
|
|
|
target_branch: 'master'
|
2017-09-10 17:25:29 +05:30
|
|
|
})
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
within_wip_explanation do
|
|
|
|
expect(page).not_to have_text(
|
2020-10-24 23:57:45 +05:30
|
|
|
'It looks like you have some draft commits in this branch'
|
2017-08-17 22:00:37 +05:30
|
|
|
)
|
|
|
|
expect(page).to have_text(
|
2022-01-26 12:08:38 +05:30
|
|
|
"Start the title with Draft: to prevent a merge request draft \
|
|
|
|
from merging before it's ready."
|
2017-08-17 22:00:37 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def within_wip_explanation(&block)
|
|
|
|
page.within '.js-no-wip-explanation' do
|
|
|
|
yield
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|