config.mock_with :rspec
config.include LoginHelpers, type: :request
- config.include GitoliteStub
config.include FactoryGirl::Syntax::Methods
config.include Devise::TestHelpers, type: :controller
config.use_transactional_fixtures = false
config.before do
- stub_gitolite!
-
# Use tmp dir for FS manipulations
temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
+++ /dev/null
-module GitoliteStub
- def stub_gitolite!
- stub_gitlab_gitolite
- stub_gitolite_admin
- end
-
- def stub_gitolite_admin
- 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) })
- gitolite_config.as_null_object
-
- Gitlab::GitoliteConfig.stub(new: gitolite_config)
- end
-end
require "repository"
require "project"
+require "shell"
# Stubs out all Git repository access done by models so that specs can run
# against fake repositories without Grit complaining that they don't exist.
@repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq'))
end
end
+
+module Gitlab
+ class Shell
+ def add_repository name
+ true
+ end
+
+ def remove_repository name
+ true
+ end
+
+ def add_key name, key
+ true
+ end
+
+ def remove_key key
+ true
+ end
+ end
+end