2016-12-22 18:45:36 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
feature 'Work In Progress help message' do
|
2017-07-26 21:52:10 +00:00
|
|
|
let!(:project) { create(:project, :public, :repository) }
|
2016-12-22 18:45:36 +00:00
|
|
|
let!(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
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,
|
|
|
|
source_branch: 'wip',
|
|
|
|
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,
|
|
|
|
source_branch: 'fix',
|
|
|
|
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
|