2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Merge Request closing issues message', js: true do
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2017-08-17 22:00:37 +05:30
|
|
|
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,
|
|
|
|
description: merge_request_description,
|
|
|
|
title: merge_request_title
|
|
|
|
)
|
|
|
|
end
|
|
|
|
let(:merge_request_description) { 'Merge Request Description' }
|
|
|
|
let(:merge_request_title) { 'Merge Request Title' }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_merge_request_path(project, merge_request)
|
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
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}" }
|
|
|
|
|
|
|
|
it 'does not display closing issue message' do
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content("Closes #{issue_1.to_reference}")
|
|
|
|
expect(page).to have_content("Mentions #{issue_2.to_reference}")
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|