From 020295fffc2329b7852c2739082986fd6b569d9e Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Sat, 22 Apr 2017 03:26:58 +0100 Subject: Use regex to skip unnecessary reference processing in ProcessCommitWorker --- spec/workers/process_commit_worker_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/workers') diff --git a/spec/workers/process_commit_worker_spec.rb b/spec/workers/process_commit_worker_spec.rb index 9afe2e610b9..6295856b461 100644 --- a/spec/workers/process_commit_worker_spec.rb +++ b/spec/workers/process_commit_worker_spec.rb @@ -20,6 +20,14 @@ 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 -- cgit v1.2.1