diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-02-22 18:36:25 +0100 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 15:40:41 +0200 |
commit | 87c0fd34557463528a552986a42f4ebb52d3bd56 (patch) | |
tree | 18b35c83421e8a96d4ec49bc248750d9d536b58c /spec/models/gpg_key_spec.rb | |
parent | e34cef0cd2fcf9a01d3f3b6dd215bbcc25d65d27 (diff) | |
download | gitlab-ce-87c0fd34557463528a552986a42f4ebb52d3bd56.tar.gz |
add / remove gpg keys to / from system keychain
Diffstat (limited to 'spec/models/gpg_key_spec.rb')
-rw-r--r-- | spec/models/gpg_key_spec.rb | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/models/gpg_key_spec.rb b/spec/models/gpg_key_spec.rb index 1c5dd95ba65..facdf91550f 100644 --- a/spec/models/gpg_key_spec.rb +++ b/spec/models/gpg_key_spec.rb @@ -13,14 +13,32 @@ describe GpgKey do it { is_expected.not_to allow_value('BEGIN PGP').for(:key) } end - context 'callbacks' do + context 'callbacks', :gpg do describe 'extract_fingerprint' do - it 'extracts the fingerprint from the gpg key', :gpg do + it 'extracts the fingerprint from the gpg key' do gpg_key = described_class.new(key: GpgHelpers.public_key) gpg_key.valid? expect(gpg_key.fingerprint).to eq '4F4840A503964251CF7D7F5DC728AF10972E97C0' end end + + describe 'add_to_keychain' do + it 'calls add_to_keychain after create' do + expect(Gitlab::Gpg).to receive(:add_to_keychain).with(GpgHelpers.public_key) + create :gpg_key + end + end + + describe 'remove_from_keychain' do + it 'calls remove_from_keychain after destroy' do + allow(Gitlab::Gpg).to receive :add_to_keychain + gpg_key = create :gpg_key + + expect(Gitlab::Gpg).to receive(:remove_from_keychain).with('4F4840A503964251CF7D7F5DC728AF10972E97C0') + + gpg_key.destroy! + end + end end describe '#key=' do @@ -37,7 +55,7 @@ describe GpgKey do end end - describe '#emails' do + describe '#emails', :gpg do it 'returns the emails from the gpg key' do gpg_key = create :gpg_key |