summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 11:02:32 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 11:02:32 +0200
commit2241d7674568423d6f57fb565b3ff53167bd5ca8 (patch)
tree51c2cad1ed92eaf80ca3f18dcaa14d4c5c076473 /spec/gitlab_keys_spec.rb
parenta8b9cb85fc1ea861dc31bdbaaeb8c76b1b5cbfd7 (diff)
downloadgitlab-shell-2241d7674568423d6f57fb565b3ff53167bd5ca8.tar.gz
add/remove keys by id
Diffstat (limited to 'spec/gitlab_keys_spec.rb')
-rw-r--r--spec/gitlab_keys_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index 9d3df34..322c05e 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -4,23 +4,23 @@ require_relative '../lib/gitlab_keys'
describe GitlabKeys do
describe :initialize do
before do
- argv('add-key', 'dzaporozhets', 'ssh-rsa AAAAB3NzaDAxx2E')
+ argv('add-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E')
@gl_keys = GitlabKeys.new
end
- it { @gl_keys.username.should == 'dzaporozhets' }
it { @gl_keys.key.should == 'ssh-rsa AAAAB3NzaDAxx2E' }
it { @gl_keys.instance_variable_get(:@command).should == 'add-key' }
+ it { @gl_keys.instance_variable_get(:@key_id).should == 'key-741' }
end
describe :add_key do
before do
- argv('add-key', 'dzaporozhets', 'ssh-rsa AAAAB3NzaDAxx2E')
+ argv('add-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E')
@gl_keys = GitlabKeys.new
end
it "should receive valid cmd" do
- valid_cmd = "echo 'command=\"#{ROOT_PATH}/bin/gitlab-shell dzaporozhets\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaDAxx2E' >> /home/git/.ssh/authorized_keys"
+ valid_cmd = "echo 'command=\"#{ROOT_PATH}/bin/gitlab-shell key-741\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaDAxx2E' >> /home/git/.ssh/authorized_keys"
@gl_keys.should_receive(:system).with(valid_cmd)
@gl_keys.send :add_key
end
@@ -28,12 +28,12 @@ describe GitlabKeys do
describe :rm_key do
before do
- argv('rm-key', 'dzaporozhets', 'ssh-rsa AAAAB3NzaDAxx2E')
+ argv('rm-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E')
@gl_keys = GitlabKeys.new
end
it "should receive valid cmd" do
- valid_cmd = "sed '/ssh-rsa AAAAB3NzaDAxx2E/d' /home/git/.ssh/authorized_keys"
+ valid_cmd = "sed '/key-741/d' /home/git/.ssh/authorized_keys"
@gl_keys.should_receive(:system).with(valid_cmd)
@gl_keys.send :rm_key
end