diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-05-25 18:59:35 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-05-25 18:59:35 +0000 |
commit | 67ea638921501296a2b1403fe039318bf7a61005 (patch) | |
tree | 8cfb57ecf777826197fb255a07b7adad9dd04eb7 /spec/workers | |
parent | 3ba9702d74c1a89defbfad5fb8193023a3475c99 (diff) | |
parent | 005496354457cefba4f54e2d19f53888b2182727 (diff) | |
download | gitlab-ce-67ea638921501296a2b1403fe039318bf7a61005.tar.gz |
Merge branch 'issue_19262' into 'master'
Prevent commits from upstream repositories to be re-processed by forks
Closes #19262
See merge request !11511
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/process_commit_worker_spec.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index 6295856b461..4e036285e8c 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -20,14 +20,6 @@ describe ProcessCommitWorker do worker.perform(project.id, -1, commit.to_hash) end - it 'does not process the commit when no issues are referenced' do - allow(worker).to receive(:build_commit).and_return(double(matches_cross_reference_regex?: false)) - - expect(worker).not_to receive(:process_commit_message) - - worker.perform(project.id, user.id, commit.to_hash) - end - it 'processes the commit message' do expect(worker).to receive(:process_commit_message).and_call_original @@ -39,6 +31,18 @@ describe ProcessCommitWorker do worker.perform(project.id, user.id, commit.to_hash) end + + context 'when commit already exists in upstream project' do + let(:forked) { create(:project, :public) } + + it 'does not process commit message' do + create(:forked_project_link, forked_to_project: forked, forked_from_project: project) + + expect(worker).not_to receive(:process_commit_message) + + worker.perform(forked.id, user.id, forked.commit.to_hash) + end + end end describe '#process_commit_message' do |