2017-12-20 04:01:21 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RebaseWorker, '#perform' do
|
2018-08-31 13:16:34 -04:00
|
|
|
include ProjectForksHelper
|
|
|
|
|
2017-12-20 04:01:21 -05:00
|
|
|
context 'when rebasing an MR from a fork where upstream has protected branches' do
|
|
|
|
let(:upstream_project) { create(:project, :repository) }
|
2018-08-31 13:16:34 -04:00
|
|
|
let(:forked_project) { fork_project(upstream_project, nil, repository: true) }
|
2017-12-20 04:01:21 -05:00
|
|
|
|
|
|
|
let(:merge_request) do
|
|
|
|
create(:merge_request,
|
2018-08-31 13:16:34 -04:00
|
|
|
source_project: forked_project,
|
2017-12-20 04:01:21 -05:00
|
|
|
source_branch: 'feature_conflict',
|
|
|
|
target_project: upstream_project,
|
|
|
|
target_branch: 'master')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets the correct project for running hooks' do
|
|
|
|
expect(MergeRequests::RebaseService)
|
2018-08-31 13:16:34 -04:00
|
|
|
.to receive(:new).with(forked_project, merge_request.author).and_call_original
|
2017-12-20 04:01:21 -05:00
|
|
|
|
|
|
|
subject.perform(merge_request, merge_request.author)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|