2016-12-05 12:52:47 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-10-03 08:35:01 +00:00
|
|
|
feature 'Merge Request closing issues message', :js do
|
2016-12-05 12:52:47 +00:00
|
|
|
let(:user) { create(:user) }
|
2017-07-26 21:52:10 +00:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2016-12-05 12:52:47 +00:00
|
|
|
let(:issue_1) { create(:issue, project: project)}
|
|
|
|
let(:issue_2) { create(:issue, project: project)}
|
|
|
|
let(:merge_request) do
|
|
|
|
create(
|
|
|
|
:merge_request,
|
|
|
|
:simple,
|
|
|
|
source_project: project,
|
2017-02-13 15:04:06 +00:00
|
|
|
description: merge_request_description,
|
|
|
|
title: merge_request_title
|
2016-12-05 12:52:47 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
let(:merge_request_description) { 'Merge Request Description' }
|
2017-02-13 15:04:06 +00:00
|
|
|
let(:merge_request_title) { 'Merge Request Title' }
|
2016-12-05 12:52:47 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in user
|
2016-12-05 12:52:47 +00:00
|
|
|
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-05 12:52:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'closing issues but not mentioning any other issue' do
|
|
|
|
let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2016-12-05 12:52:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'mentioning issues but not closing them' do
|
|
|
|
let(:merge_request_description) { "Description\n\nRefers to #{issue_1.to_reference} and #{issue_2.to_reference}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2016-12-05 12:52:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-13 15:04:06 +00:00
|
|
|
context 'closing some issues in title and mentioning, but not closing, others' do
|
|
|
|
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2017-02-13 15:04:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'closing issues using title but not mentioning any other issue' do
|
|
|
|
let(:merge_request_title) { "closing #{issue_1.to_reference}, #{issue_2.to_reference}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-02-13 15:04:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'mentioning issues using title but not closing them' do
|
|
|
|
let(:merge_request_title) { "Refers to #{issue_1.to_reference} and #{issue_2.to_reference}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-02-13 15:04:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'closing some issues using title and mentioning, but not closing, others' do
|
|
|
|
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
|
2016-12-05 12:52:47 +00:00
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-07 02:29:37 +00:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2016-12-05 12:52:47 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|