Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-24 15:21:26 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2017-09-05 13:18:31 +0300
commit508ff17b3405a4e2275fa137bd7322b728db8ed4 (patch)
tree7e00cb57f432d92b4a6af349678efe54bb2546cb /spec/lib/gitlab/gpg
parentff413ec28d5f0721646cea223fb5e5a054bde31e (diff)
pass whole commit to Gitlab::Gpg::Commit again
we need the commit object for the updated verification that also checks the committer's email to match the gpg key and user's emails.
Diffstat (limited to 'spec/lib/gitlab/gpg')
-rw-r--r--spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
index 4de4419de27..120cd1b74f7 100644
--- a/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
+++ b/spec/lib/gitlab/gpg/invalid_gpg_signature_updater_spec.rb
@@ -4,8 +4,29 @@ RSpec.describe Gitlab::Gpg::InvalidGpgSignatureUpdater do
describe '#run' do
let!(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' }
let!(:project) { create :project, :repository, path: 'sample-project' }
+ let!(:raw_commit) do
+ raw_commit = double(
+ :raw_commit,
+ signature: [
+ GpgHelpers::User1.signed_commit_signature,
+ GpgHelpers::User1.signed_commit_base_data
+ ],
+ sha: commit_sha,
+ committer_email: GpgHelpers::User1.emails.first
+ )
+
+ allow(raw_commit).to receive :save!
+
+ raw_commit
+ end
+
+ let!(:commit) do
+ create :commit, git_commit: raw_commit, project: project
+ end
before do
+ allow_any_instance_of(Project).to receive(:commit).and_return(commit)
+
allow(Rugged::Commit).to receive(:extract_signature)
.with(Rugged::Repository, commit_sha)
.and_return(