summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/key_spec.rb8
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