Commit 081c272b85d9344ff3a0b548f8f5eabc60e9a58d

Authored by Dmitriy Zaporozhets
1 parent 12198bee

Remove outdated specs and fixed key remove

app/observers/key_observer.rb
... ... @@ -12,6 +12,7 @@ class KeyObserver < ActiveRecord::Observer
12 12 def after_destroy(key)
13 13 GitoliteWorker.perform_async(
14 14 :remove_key,
  15 + key.owner_name,
15 16 key.key,
16 17 )
17 18 end
... ...
lib/gitlab/backend/shell.rb
... ... @@ -38,8 +38,8 @@ module Gitlab
38 38 # Ex.
39 39 # remove_key("sha-rsa")
40 40 #
41   - def remove_key(key_content)
42   - system("/home/git/gitlab-shell/bin/gitlab-keys rm-key \"#{key_content}\"")
  41 + def remove_key(username, key_content)
  42 + system("/home/git/gitlab-shell/bin/gitlab-keys rm-key #{username} \"#{key_content}\"")
43 43 end
44 44  
45 45  
... ...
spec/lib/gitolite_config_spec.rb
... ... @@ -1,16 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe Gitlab::GitoliteConfig do
4   - let(:gitolite) { Gitlab::GitoliteConfig.new }
5   -
6   - it { should respond_to :write_key }
7   - it { should respond_to :rm_key }
8   - it { should respond_to :update_project }
9   - it { should respond_to :update_project! }
10   - it { should respond_to :update_projects }
11   - it { should respond_to :destroy_project }
12   - it { should respond_to :destroy_project! }
13   - it { should respond_to :apply }
14   - it { should respond_to :admin_all_repo }
15   - it { should respond_to :admin_all_repo! }
16   -end
spec/lib/gitolite_spec.rb
... ... @@ -2,25 +2,17 @@ require 'spec_helper'
2 2  
3 3 describe Gitlab::Gitolite do
4 4 let(:project) { double('Project', id: 7, path: 'diaspora') }
5   - let(:gitolite_config) { double('Gitlab::GitoliteConfig') }
6 5 let(:gitolite) { Gitlab::Gitolite.new }
7 6  
8 7 before do
9   - gitolite.stub(config: gitolite_config)
10 8 Project.stub(find: project)
11 9 end
12 10  
13 11 it { should respond_to :set_key }
14 12 it { should respond_to :remove_key }
15 13  
16   - it { should respond_to :update_repository }
17   - it { should respond_to :create_repository }
  14 + it { should respond_to :add_repository }
18 15 it { should respond_to :remove_repository }
19 16  
20 17 it { gitolite.url_to_repo('diaspora').should == Gitlab.config.gitolite.ssh_path_prefix + "diaspora.git" }
21   -
22   - it "should call config update" do
23   - gitolite_config.should_receive(:update_project!)
24   - gitolite.update_repository(project.id)
25   - end
26 18 end
... ...