Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
27f4cf75
Commit
27f4cf75
authored
Feb 15, 2013
by
Jaakko Kantojärvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests to validate that invalid keys are rejected
parent
6fd88b8c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
spec/factories.rb
spec/factories.rb
+6
-0
spec/factories_spec.rb
spec/factories_spec.rb
+4
-1
spec/models/key_spec.rb
spec/models/key_spec.rb
+5
-1
No files found.
spec/factories.rb
View file @
27f4cf75
...
...
@@ -148,6 +148,12 @@ FactoryGirl.define do
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
end
end
factory
:invalid_key
do
key
do
"ssh-rsa this_is_invalid_key=="
end
end
end
factory
:milestone
do
...
...
spec/factories_spec.rb
View file @
27f4cf75
require
'spec_helper'
INVALID_FACTORIES
=
[
:key_with_a_space_in_the_middle
]
INVALID_FACTORIES
=
[
:key_with_a_space_in_the_middle
,
:invalid_key
,
]
FactoryGirl
.
factories
.
map
(
&
:name
).
each
do
|
factory_name
|
next
if
INVALID_FACTORIES
.
include?
(
factory_name
)
...
...
spec/models/key_spec.rb
View file @
27f4cf75
...
...
@@ -73,8 +73,12 @@ describe Key do
build
(
:key
,
user:
user
).
should
be_valid
end
it
"rejects the unfingerprintable key"
do
it
"rejects the unfingerprintable key
(contains space in middle)
"
do
build
(
:key_with_a_space_in_the_middle
).
should_not
be_valid
end
it
"rejects the unfingerprintable key (not a key)"
do
build
(
:invalid_key
).
should_not
be_valid
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment