2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'Merge request > User creates MR' do
|
2019-07-31 22:56:46 +05:30
|
|
|
include ProjectForksHelper
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
before do
|
|
|
|
stub_licensed_features(multiple_merge_request_assignees: false)
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
context 'non-fork merge request' do
|
|
|
|
include_context 'merge request create context'
|
|
|
|
it_behaves_like 'a creatable merge request'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'from a forked project' do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:canonical_project) { create(:project, :public, :repository) }
|
|
|
|
|
|
|
|
let(:source_project) do
|
|
|
|
fork_project(canonical_project, user,
|
|
|
|
repository: true,
|
|
|
|
namespace: user.namespace)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'to canonical project' do
|
2019-07-31 22:56:46 +05:30
|
|
|
include_context 'merge request create context'
|
2018-03-17 18:26:18 +05:30
|
|
|
it_behaves_like 'a creatable merge request'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'to another forked project' do
|
|
|
|
let(:target_project) do
|
|
|
|
fork_project(canonical_project, user,
|
|
|
|
repository: true,
|
|
|
|
namespace: user.namespace)
|
|
|
|
end
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
include_context 'merge request create context'
|
2018-03-17 18:26:18 +05:30
|
|
|
it_behaves_like 'a creatable merge request'
|
|
|
|
end
|
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
context 'source project', :js do
|
2019-03-02 22:35:43 +05:30
|
|
|
let(:user) { create(:user) }
|
2018-12-13 13:39:08 +05:30
|
|
|
let(:target_project) { create(:project, :public, :repository) }
|
|
|
|
let(:source_project) { target_project }
|
|
|
|
|
|
|
|
before do
|
|
|
|
source_project.add_maintainer(user)
|
|
|
|
|
|
|
|
sign_in(user)
|
|
|
|
visit project_new_merge_request_path(
|
|
|
|
target_project,
|
|
|
|
merge_request: {
|
|
|
|
source_project_id: source_project.id,
|
|
|
|
target_project_id: target_project.id
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'filters source project' do
|
|
|
|
find('.js-source-project').click
|
|
|
|
find('.dropdown-source-project input').set('source')
|
|
|
|
|
|
|
|
expect(find('.dropdown-source-project .dropdown-content')).not_to have_content(source_project.name)
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|