diff options
| author | randx <dmitriy.zaporozhets@gmail.com> | 2012-08-29 00:04:06 +0300 |
|---|---|---|
| committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-08-29 00:04:06 +0300 |
| commit | 7cdc5b9e0438c35c83fce739a764cb146d20c004 (patch) | |
| tree | 42cfe847873dee51c54d32c81a8543c2d75fce50 /spec/support | |
| parent | aded7056fd3a9830215f41233ef609c0f9a3b862 (diff) | |
| download | gitlab-ce-7cdc5b9e0438c35c83fce739a764cb146d20c004.tar.gz | |
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
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/gitolite_stub.rb | 35 | ||||
| -rw-r--r-- | spec/support/monkeypatch.rb | 30 |
2 files changed, 35 insertions, 30 deletions
diff --git a/spec/support/gitolite_stub.rb b/spec/support/gitolite_stub.rb new file mode 100644 index 00000000000..2a907f99bc8 --- /dev/null +++ b/spec/support/gitolite_stub.rb @@ -0,0 +1,35 @@ +module GitoliteStub + def stub_gitolite! + stub_gitlab_gitolite + stub_gitolite_admin + 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::GitoliteAdmin.stub(new: gitolite_admin) + + 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) + end +end diff --git a/spec/support/monkeypatch.rb b/spec/support/monkeypatch.rb index 855a31f06de..04bbb6fb680 100644 --- a/spec/support/monkeypatch.rb +++ b/spec/support/monkeypatch.rb @@ -1,14 +1,6 @@ # Stubbing Project <-> git host path # create project using Factory only class Project - def update_repository - true - end - - def destroy_repository - true - end - def path_to_repo File.join(Rails.root, "tmp", "tests", path) end @@ -18,22 +10,6 @@ class Project end end -class Key - def update_repository - true - end - - def repository_delete_key - true - end -end - -class UsersProject - def update_repository - true - end -end - class FakeSatellite def exists? true @@ -43,9 +19,3 @@ class FakeSatellite true end end - -class ProtectedBranch - def update_repository - true - end -end |
