diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-09-15 01:00:59 +0300 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-09-15 01:00:59 +0300 |
commit | a82977c64843aa177498f1a715121ae6e38bc323 (patch) | |
tree | ddccf4c68c46935d4dffa82fdb5c663bd5c65ac1 /spec/support | |
parent | 0d66cf2a38540056b6400c526e62ccc0cbc3144d (diff) | |
download | gitlab-ce-a82977c64843aa177498f1a715121ae6e38bc323.tar.gz |
A bit of test refactoring
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/gitolite_stub.rb | 34 |
1 files changed, 4 insertions, 30 deletions
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 |