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:
authorhaseeb <haseebeqx@gmail.com>2017-08-03 19:39:10 +0300
committerRémy Coutable <remy@rymai.me>2017-08-03 19:39:10 +0300
commitae99f05b059f613296c39dfa45c37dbcab40f4cd (patch)
tree1b067be3bd6879727efc2a5d94d2d16880c928d3 /spec/models/key_spec.rb
parent118dcff0351363426c7ac1cb3e459b001f2f9a47 (diff)
fix #35133 strip new lines from ssh keys
Diffstat (limited to 'spec/models/key_spec.rb')
-rw-r--r--spec/models/key_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index d41717d0223..251d0cfd08c 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -94,15 +94,17 @@ describe Key do
expect(key).not_to be_valid
end
- it 'rejects the unfingerprintable key (not a key)' do
- expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid
+ it 'accepts a key with newline charecters after stripping them' do
+ key = build(:key)
+ key.key = key.key.insert(100, "\n")
+ key.key = key.key.insert(40, "\r\n")
+ expect(key).to be_valid
end
- it 'rejects the multiple line key' do
- key = build(:key)
- key.key.tr!(' ', "\n")
- expect(key).not_to be_valid
+ it 'rejects the unfingerprintable key (not a key)' do
+ expect(build(:key, key: 'ssh-rsa an-invalid-key==')).not_to be_valid
end
+
end
context 'callbacks' do