Split gitolite backend. Use gitolite_config methods moved to separate class
This commit is contained in:
parent
137594dd08
commit
79021e674b
7 changed files with 241 additions and 186 deletions
16
spec/lib/gitolite_config_spec.rb
Normal file
16
spec/lib/gitolite_config_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::GitoliteConfig do
|
||||
let(:gitolite) { Gitlab::GitoliteConfig.new }
|
||||
|
||||
it { should respond_to :write_key }
|
||||
it { should respond_to :rm_key }
|
||||
it { should respond_to :update_project }
|
||||
it { should respond_to :update_project! }
|
||||
it { should respond_to :update_projects }
|
||||
it { should respond_to :destroy_project }
|
||||
it { should respond_to :destroy_project! }
|
||||
it { should respond_to :apply }
|
||||
it { should respond_to :admin_all_repo }
|
||||
it { should respond_to :admin_all_repo! }
|
||||
end
|
25
spec/lib/gitolite_spec.rb
Normal file
25
spec/lib/gitolite_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::Gitolite do
|
||||
let(:project) { double('Project', path: 'diaspora') }
|
||||
let(:gitolite_config) { double('Gitlab::GitoliteConfig') }
|
||||
let(:gitolite) { Gitlab::Gitolite.new }
|
||||
|
||||
before do
|
||||
gitolite.stub(config: gitolite_config)
|
||||
end
|
||||
|
||||
it { should respond_to :set_key }
|
||||
it { should respond_to :remove_key }
|
||||
|
||||
it { should respond_to :update_repository }
|
||||
it { should respond_to :create_repository }
|
||||
it { should respond_to :remove_repository }
|
||||
|
||||
it { gitolite.url_to_repo('diaspora').should == Gitlab.config.ssh_path + "diaspora.git" }
|
||||
|
||||
it "should call config update" do
|
||||
gitolite_config.should_receive(:update_project!)
|
||||
gitolite.update_repository project
|
||||
end
|
||||
end
|
|
@ -17,7 +17,7 @@ module GitoliteStub
|
|||
)
|
||||
|
||||
gitolite_admin = double(
|
||||
'Gitolite::GitoliteAdmin',
|
||||
'Gitolite::GitoliteAdmin',
|
||||
config: gitolite_config,
|
||||
save: true,
|
||||
)
|
||||
|
@ -27,9 +27,21 @@ module GitoliteStub
|
|||
end
|
||||
|
||||
def stub_gitlab_gitolite
|
||||
gitlab_gitolite = Gitlab::Gitolite.new
|
||||
Gitlab::Gitolite.stub(new: gitlab_gitolite)
|
||||
gitlab_gitolite.stub(configure: ->() { yield(self) })
|
||||
gitlab_gitolite.stub(update_keys: true)
|
||||
gitolite_config = double('Gitlab::GitoliteConfig')
|
||||
gitolite_config.stub(
|
||||
apply: ->() { yield(self) },
|
||||
write_key: true,
|
||||
rm_key: true,
|
||||
update_projects: true,
|
||||
update_project: true,
|
||||
update_project!: true,
|
||||
destroy_project: true,
|
||||
destroy_project!: true,
|
||||
admin_all_repo: true,
|
||||
admin_all_repo!: true,
|
||||
|
||||
)
|
||||
|
||||
Gitlab::GitoliteConfig.stub(new: gitolite_config)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue