2016-06-01 07:18:04 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'Merge request created from fork' do
|
2017-09-29 08:04:50 +00:00
|
|
|
include ProjectForksHelper
|
|
|
|
|
2016-06-01 07:18:04 +00:00
|
|
|
given(:user) { create(:user) }
|
2017-07-26 21:52:10 +00:00
|
|
|
given(:project) { create(:project, :public, :repository) }
|
2017-09-29 08:04:50 +00:00
|
|
|
given(:forked_project) { fork_project(project, user, repository: true) }
|
2016-06-01 07:18:04 +00:00
|
|
|
|
|
|
|
given!(:merge_request) do
|
2017-09-29 08:04:50 +00:00
|
|
|
create(:merge_request_with_diffs, source_project: forked_project,
|
2016-06-01 08:26:33 +00:00
|
|
|
target_project: project,
|
|
|
|
description: 'Test merge request')
|
2016-06-01 07:18:04 +00:00
|
|
|
end
|
|
|
|
|
2016-06-01 08:26:33 +00:00
|
|
|
background do
|
2017-09-29 08:04:50 +00:00
|
|
|
forked_project.team << [user, :master]
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in user
|
2016-06-01 07:18:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'user can access merge request' do
|
2016-06-01 08:26:33 +00:00
|
|
|
visit_merge_request(merge_request)
|
|
|
|
|
2016-06-01 07:18:04 +00:00
|
|
|
expect(page).to have_content 'Test merge request'
|
|
|
|
end
|
2016-10-19 16:13:04 +00:00
|
|
|
|
2017-07-27 14:36:39 +00:00
|
|
|
context 'when a commit comment exists on the merge request' do
|
|
|
|
given(:comment) { 'A commit comment' }
|
|
|
|
given(:reply) { 'A reply comment' }
|
|
|
|
|
|
|
|
background do
|
|
|
|
create(:note_on_commit, note: comment,
|
2017-09-29 08:04:50 +00:00
|
|
|
project: forked_project,
|
2017-07-27 14:36:39 +00:00
|
|
|
commit_id: merge_request.commit_shas.first)
|
|
|
|
end
|
|
|
|
|
2017-10-03 08:35:01 +00:00
|
|
|
scenario 'user can reply to the comment', :js do
|
2017-07-27 14:36:39 +00:00
|
|
|
visit_merge_request(merge_request)
|
|
|
|
|
|
|
|
expect(page).to have_content(comment)
|
|
|
|
|
|
|
|
page.within('.discussion-notes') do
|
|
|
|
find('.btn-text-field').click
|
|
|
|
find('#note_note').send_keys(reply)
|
|
|
|
find('.comment-btn').click
|
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_content(reply)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-10-19 16:13:04 +00:00
|
|
|
context 'source project is deleted' do
|
|
|
|
background do
|
|
|
|
MergeRequests::MergeService.new(project, user).execute(merge_request)
|
2017-09-29 08:04:50 +00:00
|
|
|
forked_project.destroy!
|
2016-10-19 16:13:04 +00:00
|
|
|
end
|
|
|
|
|
2017-10-03 08:35:01 +00:00
|
|
|
scenario 'user can access merge request', :js do
|
2016-10-19 16:13:04 +00:00
|
|
|
visit_merge_request(merge_request)
|
|
|
|
|
|
|
|
expect(page).to have_content 'Test merge request'
|
|
|
|
expect(page).to have_content "(removed):#{merge_request.source_branch}"
|
|
|
|
end
|
|
|
|
end
|
2016-06-01 08:26:33 +00:00
|
|
|
|
|
|
|
context 'pipeline present in source project' do
|
|
|
|
given(:pipeline) do
|
2016-08-11 13:22:35 +00:00
|
|
|
create(:ci_pipeline,
|
2017-09-29 08:04:50 +00:00
|
|
|
project: forked_project,
|
2016-08-11 13:22:35 +00:00
|
|
|
sha: merge_request.diff_head_sha,
|
|
|
|
ref: merge_request.source_branch)
|
2016-06-01 08:26:33 +00:00
|
|
|
end
|
|
|
|
|
2016-08-11 13:22:35 +00:00
|
|
|
background do
|
|
|
|
create(:ci_build, pipeline: pipeline, name: 'rspec')
|
|
|
|
create(:ci_build, pipeline: pipeline, name: 'spinach')
|
|
|
|
end
|
2016-06-01 08:26:33 +00:00
|
|
|
|
2017-10-03 08:35:01 +00:00
|
|
|
scenario 'user visits a pipelines page', :js do
|
2016-06-01 08:26:33 +00:00
|
|
|
visit_merge_request(merge_request)
|
2016-11-24 15:45:34 +00:00
|
|
|
page.within('.merge-request-tabs') { click_link 'Pipelines' }
|
2016-06-01 08:26:33 +00:00
|
|
|
|
2017-06-16 12:00:28 +00:00
|
|
|
page.within('.ci-table') do
|
2016-11-24 15:45:34 +00:00
|
|
|
expect(page).to have_content pipeline.id
|
2016-06-01 08:26:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def visit_merge_request(mr)
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_merge_request_path(project, mr)
|
2016-06-01 08:26:33 +00:00
|
|
|
end
|
2016-06-01 07:18:04 +00:00
|
|
|
end
|