diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-10-08 20:34:50 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-10-08 20:34:50 -0400 |
commit | 69b41ba04331e95739b25c77b3f5f198c0e64bae (patch) | |
tree | 902ba9a9417b951ac35bd3c9023f9a673b66d908 /spec | |
parent | 680b6d88a5c0d63deeb2909f1c83e3630db87780 (diff) | |
download | gitlab-ce-69b41ba04331e95739b25c77b3f5f198c0e64bae.tar.gz |
Normalize space-like characters in keys before output to gitlab-shellrs-issue-2970
gitlab-shell expects only one tab separator per key, and an SSH key with
a tab character in the comment, for example, would break things.
Closes #2970
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/backend/shell_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/lib/gitlab/backend/shell_spec.rb b/spec/lib/gitlab/backend/shell_spec.rb index b6d04330599..b60e23454d6 100644 --- a/spec/lib/gitlab/backend/shell_spec.rb +++ b/spec/lib/gitlab/backend/shell_spec.rb @@ -15,4 +15,17 @@ describe Gitlab::Shell do it { is_expected.to respond_to :fork_repository } it { expect(gitlab_shell.url_to_repo('diaspora')).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git") } + + describe Gitlab::Shell::KeyAdder do + describe '#add_key' do + it 'normalizes space characters in the key' do + io = spy + adder = described_class.new(io) + + adder.add_key('key-42', "sha-rsa foo\tbar\tbaz") + + expect(io).to have_received(:puts).with("key-42\tsha-rsa foo bar baz") + end + end + end end |