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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
273df6a4
Commit
273df6a4
authored
Apr 09, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the invalid key factories
They're only used once each, and they're easy to build in-place.
parent
5155b979
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
22 deletions
+9
-22
spec/factories.rb
spec/factories.rb
+0
-12
spec/factories_spec.rb
spec/factories_spec.rb
+0
-6
spec/models/key_spec.rb
spec/models/key_spec.rb
+9
-4
No files found.
spec/factories.rb
View file @
273df6a4
...
...
@@ -101,23 +101,11 @@ FactoryGirl.define do
user
end
factory
:key_with_a_space_in_the_middle
do
key
do
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
end
end
factory
:another_key
do
key
do
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmTillFzNTrrGgwaCKaSj+QCz81E6jBc/s9av0+3b1Hwfxgkqjl4nAK/OD2NjgyrONDTDfR8cRN4eAAy6nY8GLkOyYBDyuc5nTMqs5z3yVuTwf3koGm/YQQCmo91psZ2BgDFTor8SVEE5Mm1D1k3JDMhDFxzzrOtRYFPci9lskTJaBjpqWZ4E9rDTD2q/QZntCqbC3wE9uSemRQB5f8kik7vD/AD8VQXuzKladrZKkzkONCPWsXDspUitjM8HkQdOf0PsYn1CMUC1xKYbCxkg5TkEosIwGv6CoEArUrdu/4+10LVslq494mAvEItywzrluCLCnwELfW+h/m8UHoVhZ"
end
end
factory
:invalid_key
do
key
do
"ssh-rsa this_is_invalid_key=="
end
end
end
factory
:email
do
...
...
spec/factories_spec.rb
View file @
273df6a4
require
'spec_helper'
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
)
describe
"
#{
factory_name
}
factory"
do
it
'should be valid'
do
expect
(
build
(
factory_name
)).
to
be_valid
...
...
spec/models/key_spec.rb
View file @
273df6a4
...
...
@@ -58,12 +58,17 @@ describe Key do
expect
(
build
(
:key
)).
to
be_valid
end
it
"rejects the unfingerprintable key (contains space in middle)"
do
expect
(
build
(
:key_with_a_space_in_the_middle
)).
not_to
be_valid
it
'rejects an unfingerprintable key that contains a space'
do
key
=
build
(
:key
)
# Not always the middle, but close enough
key
.
key
=
key
.
key
[
0
..
100
]
+
' '
+
key
.
key
[
100
..-
1
]
expect
(
key
).
not_to
be_valid
end
it
"rejects the unfingerprintable key (not a key)"
do
expect
(
build
(
:
invalid_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
...
...
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