diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-28 10:23:56 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-28 10:23:56 +0200 |
commit | 39ee52f1b168f3c6d2c9f27a3311aa7c785a0b20 (patch) | |
tree | 48bdcbdcc0c8188955ae2b09cf3d1884c24e37cb /spec/workers | |
parent | abb5b9f6e526195c4eb027d5b7c28e070d9ac3c1 (diff) | |
download | gitlab-ce-39ee52f1b168f3c6d2c9f27a3311aa7c785a0b20.tar.gz |
Expire cache when merge request source branch was removedfix-branches-cache-after-merge
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/merge_worker_spec.rb | 28 | ||||
-rw-r--r-- | spec/workers/post_receive_spec.rb | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/spec/workers/merge_worker_spec.rb b/spec/workers/merge_worker_spec.rb new file mode 100644 index 00000000000..b11c5de94e3 --- /dev/null +++ b/spec/workers/merge_worker_spec.rb @@ -0,0 +1,28 @@ +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 diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 46eae9ab081..e4151b9bb6a 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -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) |