summaryrefslogtreecommitdiff
path: root/spec/workers/create_commit_signature_worker_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/workers/create_commit_signature_worker_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/workers/create_commit_signature_worker_spec.rb')
-rw-r--r--spec/workers/create_commit_signature_worker_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/workers/create_commit_signature_worker_spec.rb b/spec/workers/create_commit_signature_worker_spec.rb
index f40482f2361..fd5d99b3265 100644
--- a/spec/workers/create_commit_signature_worker_spec.rb
+++ b/spec/workers/create_commit_signature_worker_spec.rb
@@ -17,6 +17,25 @@ describe CreateCommitSignatureWorker do
subject { described_class.new.perform(commit_shas, project.id) }
context 'when a signature is found' do
+ it_behaves_like 'an idempotent worker' do
+ let(:job_args) { [commit_shas, project.id] }
+
+ before do
+ # Removing the stub which can cause bugs for multiple calls to
+ # Project#commits_by.
+ allow(project).to receive(:commits_by).and_call_original
+
+ # Making sure it still goes through all the perform execution.
+ allow_next_instance_of(::Commit) do |commit|
+ allow(commit).to receive(:signature_type).and_return(:PGP)
+ end
+
+ allow_next_instance_of(::Gitlab::Gpg::Commit) do |gpg|
+ expect(gpg).to receive(:signature).once.and_call_original
+ end
+ end
+ end
+
it 'calls Gitlab::Gpg::Commit#signature' do
commits.each do |commit|
allow(commit).to receive(:signature_type).and_return(:PGP)