diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-13 09:33:55 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-13 09:33:55 +0000 |
commit | 00053c805c9c83baca25b83919f89b024c51d7c8 (patch) | |
tree | 4afb25c2ae87c81cbe76ca9797c6d3e65a43e3df /spec | |
parent | 98291295a782b5fdf74e0b4742a35857054facbb (diff) | |
parent | 562d78a65a5d6d9ebd593b0fe20d1cbc187bc570 (diff) | |
download | gitlab-ce-00053c805c9c83baca25b83919f89b024c51d7c8.tar.gz |
Merge branch 'ssh-key-linebreaks' into 'master'
Add error message for SSH key linebreaks
Solves this [request](http://feedback.gitlab.com/forums/176466-general/suggestions/5653544-check-for-linebreaks-in-ssh-key).
See merge request !672
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/key_spec.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index fbb9e162952..456bf221d62 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -63,7 +63,7 @@ describe Key do key = build(:key) # Not always the middle, but close enough - key.key = key.key[0..100] + ' ' + key.key[100..-1] + key.key = key.key[0..100] + ' ' + key.key[101..-1] expect(key).not_to be_valid end @@ -71,6 +71,12 @@ describe Key do it 'rejects the unfingerprintable key (not a key)' do expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid end + + it 'rejects the multiple line key' do + key = build(:key) + key.key.gsub!(' ', "\n") + expect(key).not_to be_valid + end end context 'callbacks' do |