2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2016-12-22 18:45:36 +00:00
|
|
|
|
2017-08-01 18:03:07 +00:00
|
|
|
describe 'Merge request > User sees WIP help message' do
|
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:user) { project.creator }
|
2016-12-22 18:45:36 +00:00
|
|
|
|
|
|
|
before do
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2016-12-22 18:45:36 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'with WIP commits' do
|
|
|
|
it 'shows a specific WIP hint' do
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_new_merge_request_path(
|
2016-12-22 18:45:36 +00:00
|
|
|
project,
|
|
|
|
merge_request: {
|
|
|
|
source_project_id: project.id,
|
|
|
|
target_project_id: project.id,
|
2018-11-07 13:32:20 +00:00
|
|
|
source_branch: 'wip',
|
2016-12-22 18:45:36 +00:00
|
|
|
target_branch: 'master'
|
2017-07-06 16:20:50 +00:00
|
|
|
})
|
2016-12-22 18:45:36 +00:00
|
|
|
|
|
|
|
within_wip_explanation do
|
|
|
|
expect(page).to have_text(
|
|
|
|
'It looks like you have some WIP commits in this branch'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'without WIP commits' do
|
|
|
|
it 'shows the regular WIP message' do
|
2017-06-29 17:06:35 +00:00
|
|
|
visit project_new_merge_request_path(
|
2016-12-22 18:45:36 +00:00
|
|
|
project,
|
|
|
|
merge_request: {
|
|
|
|
source_project_id: project.id,
|
|
|
|
target_project_id: project.id,
|
2018-11-07 13:32:20 +00:00
|
|
|
source_branch: 'fix',
|
2016-12-22 18:45:36 +00:00
|
|
|
target_branch: 'master'
|
2017-07-06 16:20:50 +00:00
|
|
|
})
|
2016-12-22 18:45:36 +00:00
|
|
|
|
|
|
|
within_wip_explanation do
|
|
|
|
expect(page).not_to have_text(
|
|
|
|
'It looks like you have some WIP commits in this branch'
|
|
|
|
)
|
|
|
|
expect(page).to have_text(
|
|
|
|
"Start the title with WIP: to prevent a Work In Progress merge \
|
|
|
|
request 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
|