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

34 lines
1 KiB
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2015-09-25 12:07:36 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe MergeWorker do
2015-09-25 12:07:36 +05:30
describe "remove source branch" do
let!(:merge_request) { create(:merge_request, source_branch: "markdown") }
let!(:source_project) { merge_request.source_project }
let!(:project) { merge_request.project }
let!(:author) { merge_request.author }
before do
2018-11-18 11:00:15 +05:30
source_project.add_maintainer(author)
2016-06-22 15:30:34 +05:30
source_project.repository.expire_branches_cache
2015-09-25 12:07:36 +05:30
end
2021-04-17 20:07:23 +05:30
it 'clears cache of source repo after removing source branch', :sidekiq_inline do
2015-09-25 12:07:36 +05:30
expect(source_project.repository.branch_names).to include('markdown')
2017-08-17 22:00:37 +05:30
described_class.new.perform(
2015-09-25 12:07:36 +05:30
merge_request.id, merge_request.author_id,
commit_message: 'wow such merge',
2019-12-26 22:10:19 +05:30
sha: merge_request.diff_head_sha,
2015-09-25 12:07:36 +05:30
should_remove_source_branch: true)
merge_request.reload
expect(merge_request).to be_merged
2016-06-02 11:05:42 +05:30
source_project.repository.expire_branches_cache
2015-09-25 12:07:36 +05:30
expect(source_project.repository.branch_names).not_to include('markdown')
end
end
end