debian-mirror-gitlab/spec/workers/rebase_worker_spec.rb

28 lines
863 B
Ruby
Raw Normal View History

2019-05-18 00:54:41 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
describe RebaseWorker, '#perform' do
2018-12-13 13:39:08 +05:30
include ProjectForksHelper
2018-03-17 18:26:18 +05:30
context 'when rebasing an MR from a fork where upstream has protected branches' do
let(:upstream_project) { create(:project, :repository) }
2018-12-13 13:39:08 +05:30
let(:forked_project) { fork_project(upstream_project, nil, repository: true) }
2018-03-17 18:26:18 +05:30
let(:merge_request) do
create(:merge_request,
2018-12-13 13:39:08 +05:30
source_project: forked_project,
2018-03-17 18:26:18 +05:30
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-12-13 13:39:08 +05:30
.to receive(:new).with(forked_project, merge_request.author).and_call_original
2018-03-17 18:26:18 +05:30
2019-02-15 15:39:39 +05:30
subject.perform(merge_request.id, merge_request.author.id)
2018-03-17 18:26:18 +05:30
end
end
end