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-07-06 12:55:56 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 16:43:37 +0300
commitdeb474b4137c8ab4ce16f4d46e011be593f0de60 (patch)
tree4fc2b109ae30520fc9ca642a315a326345262eb8 /spec/lib/gitlab/gpg_spec.rb
parentb66e3726dc377c2bb5c92983db4ec4c8d27237c4 (diff)
extract common method
Diffstat (limited to 'spec/lib/gitlab/gpg_spec.rb')
-rw-r--r--spec/lib/gitlab/gpg_spec.rb29
1 files changed, 21 insertions, 8 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index 497fbeab5d5..ebb7720eaea 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -2,16 +2,15 @@ require 'rails_helper'
describe Gitlab::Gpg do
describe '.fingerprints_from_key' do
- it 'returns the fingerprint' do
- expect(
- described_class.fingerprints_from_key(GpgHelpers::User1.public_key)
- ).to eq [GpgHelpers::User1.fingerprint]
+ before do
+ # make sure that each method is using the temporary keychain
+ expect(described_class).to receive(:using_tmp_keychain).and_call_original
end
- it 'returns an empty array when the key is invalid' do
- expect(
- described_class.fingerprints_from_key('bogus')
- ).to eq []
+ it 'returns CurrentKeyChain.fingerprints_from_key' do
+ expect(Gitlab::Gpg::CurrentKeyChain).to receive(:fingerprints_from_key).with(GpgHelpers::User1.public_key)
+
+ described_class.fingerprints_from_key(GpgHelpers::User1.public_key)
end
end
@@ -65,4 +64,18 @@ describe Gitlab::Gpg::CurrentKeyChain do
)
end
end
+
+ describe '.fingerprints_from_key' do
+ it 'returns the fingerprint' do
+ expect(
+ described_class.fingerprints_from_key(GpgHelpers::User1.public_key)
+ ).to eq [GpgHelpers::User1.fingerprint]
+ end
+
+ it 'returns an empty array when the key is invalid' do
+ expect(
+ described_class.fingerprints_from_key('bogus')
+ ).to eq []
+ end
+ end
end