Use similar interface to access gitolite
Simplified gitolite handle logic Stubn over monkeypatch Stub only specific methods in Gitlab:Gitolite Moved grach auth to lib added specs for keys observer removes SshKey role
This commit is contained in:
parent
aded7056fd
commit
7cdc5b9e04
20 changed files with 155 additions and 88 deletions
34
spec/observers/key_observer_spec.rb
Normal file
34
spec/observers/key_observer_spec.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe KeyObserver do
|
||||
before do
|
||||
@key = double('Key',
|
||||
identifier: 'admin_654654',
|
||||
key: '== a vaild ssh key',
|
||||
projects: [],
|
||||
is_deploy_key: false
|
||||
)
|
||||
|
||||
@gitolite = double('Gitlab::Gitolite',
|
||||
set_key: true,
|
||||
remove_key: true
|
||||
)
|
||||
|
||||
@observer = KeyObserver.instance
|
||||
@observer.stub(:git_host => @gitolite)
|
||||
end
|
||||
|
||||
context :after_save do
|
||||
it do
|
||||
@gitolite.should_receive(:set_key).with(@key.identifier, @key.key, @key.projects)
|
||||
@observer.after_save(@key)
|
||||
end
|
||||
end
|
||||
|
||||
context :after_destroy do
|
||||
it do
|
||||
@gitolite.should_receive(:remove_key).with(@key.identifier, @key.projects)
|
||||
@observer.after_destroy(@key)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue