summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-11 18:41:10 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-02-11 18:41:10 +0200
commitaef782888f58ecc4ccc130120e8ff93add3ffa98 (patch)
tree441c4e4d48ebe405d0b351f1f0b11222a35cf5c5 /spec
parent1284f21c073e42c44b9faa7b0ad1ec90b66ca8fb (diff)
parent4b9c28bccded2064fc95cf891b87a375d5bcdcf7 (diff)
downloadgitlab-ce-aef782888f58ecc4ccc130120e8ff93add3ffa98.tar.gz
Merge pull request #5261 from devaroop/retrieve_ssh_keys_by_ssh
ssh keys publically available for sysadmins via http, the github way
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_spec.rb11
-rw-r--r--spec/routing/routing_spec.rb5
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 5e53ed09b58..fd8d7133ae9 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -303,6 +303,17 @@ describe User do
end
end
+ describe 'all_ssh_keys' do
+ it { should have_many(:keys).dependent(:destroy) }
+
+ it "should have all ssh keys" do
+ user = create :user
+ key = create :key, key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD33bWLBxu48Sev9Fert1yzEO4WGcWglWF7K/AwblIUFselOt/QdOL9DSjpQGxLagO1s9wl53STIO8qGS4Ms0EJZyIXOEFMjFJ5xmjSy+S37By4sG7SsltQEHMxtbtFOaW5LV2wCrX+rUsRNqLMamZjgjcPO0/EgGCXIGMAYW4O7cwGZdXWYIhQ1Vwy+CsVMDdPkPgBXqK7nR/ey8KMs8ho5fMNgB5hBw/AL9fNGhRw3QTD6Q12Nkhl4VZES2EsZqlpNnJttnPdp847DUsT6yuLRlfiQfz5Cn9ysHFdXObMN5VYIiPFwHeYCZp1X2S4fDZooRE8uOLTfxWHPXwrhqSH", user_id: user.id
+
+ user.all_ssh_keys.should include(key.key)
+ end
+ end
+
describe :avatar_type do
let(:user) { create(:user) }
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb
index bcbf37e2eeb..8929a48973d 100644
--- a/spec/routing/routing_spec.rb
+++ b/spec/routing/routing_spec.rb
@@ -176,6 +176,11 @@ describe Profiles::KeysController, "routing" do
it "to #destroy" do
delete("/profile/keys/1").should route_to('profiles/keys#destroy', id: '1')
end
+
+ # get all the ssh-keys of a user
+ it "to #get_keys" do
+ get("/foo.keys").should route_to('profiles/keys#get_keys', username: 'foo')
+ end
end
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy