BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8de11d88
Commit
8de11d88
authored
Feb 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
331d9576
1bcf0aa2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
keys_controller.rb
app/controllers/profiles/keys_controller.rb
+1
-1
profile_keys_controller_spec.rb
spec/controllers/profile_keys_controller_spec.rb
+49
-0
factories.rb
spec/factories.rb
+6
-0
No files found.
app/controllers/profiles/keys_controller.rb
View file @
8de11d88
...
@@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController
...
@@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController
begin
begin
user
=
User
.
find_by_username
(
params
[
:username
])
user
=
User
.
find_by_username
(
params
[
:username
])
if
user
.
present?
if
user
.
present?
render
text:
user
.
all_ssh_keys
.
join
(
'\n'
)
render
text:
user
.
all_ssh_keys
.
join
(
"
\n
"
)
else
else
render_404
and
return
render_404
and
return
end
end
...
...
spec/controllers/profile_keys_controller_spec.rb
0 → 100644
View file @
8de11d88
require
'spec_helper'
describe
Profiles
::
KeysController
do
let
(
:user
)
{
create
(
:user
)
}
describe
"#get_keys"
do
describe
"non existant user"
do
it
"should generally not work"
do
get
:get_keys
,
username:
'not-existent'
expect
(
response
).
not_to
be_success
end
end
describe
"user with no keys"
do
it
"should generally work"
do
get
:get_keys
,
username:
user
.
username
expect
(
response
).
to
be_success
end
it
"should render all keys separated with a new line"
do
get
:get_keys
,
username:
user
.
username
expect
(
response
.
body
).
to
eq
(
""
)
end
end
describe
"user with keys"
do
before
do
user
.
keys
<<
create
(
:key
)
user
.
keys
<<
create
(
:another_key
)
end
it
"should generally work"
do
get
:get_keys
,
username:
user
.
username
expect
(
response
).
to
be_success
end
it
"should render all keys separated with a new line"
do
get
:get_keys
,
username:
user
.
username
expect
(
response
.
body
).
not_to
eq
(
""
)
expect
(
response
.
body
).
to
eq
(
user
.
all_ssh_keys
.
join
(
"
\n
"
))
end
end
end
end
spec/factories.rb
View file @
8de11d88
...
@@ -207,6 +207,12 @@ FactoryGirl.define do
...
@@ -207,6 +207,12 @@ FactoryGirl.define do
end
end
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
factory
:invalid_key
do
key
do
key
do
"ssh-rsa this_is_invalid_key=="
"ssh-rsa this_is_invalid_key=="
...
...
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