diff options
author | Christian Ratzenhofer <christian.ratzenhofer@cdnm.at> | 2018-03-16 07:39:55 +0000 |
---|---|---|
committer | Christian Ratzenhofer <christian.ratzenhofer@cdnm.at> | 2019-04-30 13:18:07 +0200 |
commit | a9e6eb77f053798596cdce189dd7ad181c014f44 (patch) | |
tree | f4503cddeaa9b22dd0a63362b5bed6b196b090ae /spec | |
parent | 344cc6b443e08ec5648fcf8a3035e46bb404fd6a (diff) | |
download | gitlab-shell-a9e6eb77f053798596cdce189dd7ad181c014f44.tar.gz |
Actually print matched keys in list_keys
Diffstat (limited to 'spec')
-rw-r--r-- | spec/gitlab_keys_spec.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb index f86d00d..86128f6 100644 --- a/spec/gitlab_keys_spec.rb +++ b/spec/gitlab_keys_spec.rb @@ -95,16 +95,20 @@ describe GitlabKeys do end end - describe :list_keys do - let(:gitlab_keys) do - build_gitlab_keys('add-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E') + describe ':list_keys' do + let(:gitlab_keys) { build_gitlab_keys('list_keys') } + let(:key_data) { "%s\n%s\n" % [described_class.key_line('key-741', 'ssh-rsa AAAAB3NzaDAxx2E'), described_class.key_line('key-742', 'ssh-rsa AAAAB3NzaDAxx2E')] } + let(:key_output) { "key-741 AAAAB3NzaDAxx2E\nkey-742 AAAAB3NzaDAxx2E\n" } + + before do + create_authorized_keys_fixture( + existing_content: + key_data + ) end - it 'adds a key and lists it' do - create_authorized_keys_fixture - gitlab_keys.send :add_key - auth_line1 = 'key-741 AAAAB3NzaDAxx2E' - expect(gitlab_keys.send(:list_keys)).to eq("#{auth_line1}\n") + it 'outputs the keys with IDs, separated by newlines' do + expect { gitlab_keys.send(:list_keys) }.to output(key_output).to_stdout end end |