From a82977c64843aa177498f1a715121ae6e38bc323 Mon Sep 17 00:00:00 2001 From: randx Date: Sat, 15 Sep 2012 01:00:59 +0300 Subject: A bit of test refactoring --- spec/support/gitolite_stub.rb | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'spec/support') diff --git a/spec/support/gitolite_stub.rb b/spec/support/gitolite_stub.rb index 037b09cd555..574bb5a12a3 100644 --- a/spec/support/gitolite_stub.rb +++ b/spec/support/gitolite_stub.rb @@ -5,42 +5,16 @@ module GitoliteStub end def stub_gitolite_admin - gitolite_repo = mock( - clean_permissions: true, - add_permission: true - ) - - gitolite_config = mock( - add_repo: true, - get_repo: gitolite_repo, - has_repo?: true - ) - - gitolite_admin = double( - 'Gitolite::GitoliteAdmin', - config: gitolite_config, - save: true, - ) + gitolite_admin = double('Gitolite::GitoliteAdmin') + gitolite_admin.as_null_object Gitolite::GitoliteAdmin.stub(new: gitolite_admin) - end def stub_gitlab_gitolite 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, - - ) + gitolite_config.stub(apply: ->() { yield(self) }) + gitolite_config.as_null_object Gitlab::GitoliteConfig.stub(new: gitolite_config) end -- cgit v1.2.1