2016-12-05 07:52:47 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-10-03 04:35:01 -04:00
|
|
|
feature 'Merge Request closing issues message', :js do
|
2016-12-05 07:52:47 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-07-26 17:52:10 -04:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2016-12-05 07:52:47 -05: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 10:04:06 -05:00
|
|
|
description: merge_request_description,
|
|
|
|
title: merge_request_title
|
2016-12-05 07:52:47 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
let(:merge_request_description) { 'Merge Request Description' }
|
2017-02-13 10:04:06 -05:00
|
|
|
let(:merge_request_title) { 'Merge Request Title' }
|
2016-12-05 07:52:47 -05:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2016-12-05 07:52:47 -05:00
|
|
|
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2016-12-05 07:52:47 -05: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-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2016-12-05 07:52:47 -05: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-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2016-12-05 07:52:47 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-13 10:04:06 -05: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-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2017-02-13 10:04:06 -05: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-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-02-13 10:04:06 -05: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-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-02-13 10:04:06 -05: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 07:52:47 -05:00
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-08-06 22:29:37 -04:00
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2016-12-05 07:52:47 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|