BigW Consortium Gitlab

Commit bb86df1b by Valery Sizov

Merge branch 'fix-branches-cache-after-merge' into 'master'

Expire cache when merge request source branch was removed Re-implement !1160 for 8.0. Also we have tests for MergeWorker now! Yay Signed-off-by: 's avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !1224
parents 86dd1bd7 39ee52f1
......@@ -14,6 +14,10 @@ class MergeWorker
if result[:status] == :success && params[:should_remove_source_branch].present?
DeleteBranchService.new(merge_request.source_project, current_user).
execute(merge_request.source_branch)
merge_request.source_project.repository.expire_branch_names
end
result
end
end
require 'spec_helper'
describe MergeWorker do
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
source_project.team << [author, :master]
source_project.repository.expire_branch_names
end
it 'clears cache of source repo after removing source branch' do
expect(source_project.repository.branch_names).to include('markdown')
MergeWorker.new.perform(
merge_request.id, merge_request.author_id,
commit_message: 'wow such merge',
should_remove_source_branch: true)
merge_request.reload
expect(merge_request).to be_merged
expect(source_project.repository.branch_names).not_to include('markdown')
end
end
end
......@@ -4,7 +4,7 @@ describe PostReceive do
let(:changes) { "123456 789012 refs/heads/tést\n654321 210987 refs/tags/tag" }
let(:wrongly_encoded_changes) { changes.encode("ISO-8859-1").force_encoding("UTF-8") }
let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) }
context "as a resque worker" do
it "reponds to #perform" do
expect(PostReceive.new).to respond_to(:perform)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment