2013-01-04 20:45:30 +01:00
|
|
|
require "repository"
|
|
|
|
require "project"
|
|
|
|
|
2012-08-28 07:42:28 +02:00
|
|
|
# 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.
|
2013-01-02 23:01:08 +01:00
|
|
|
class Project
|
2013-01-04 20:45:30 +01:00
|
|
|
def repository
|
|
|
|
if path == "empty" || !path
|
|
|
|
nil
|
|
|
|
else
|
|
|
|
GitLabTestRepo.new(path_with_namespace)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-29 07:55:41 +02:00
|
|
|
def satellite
|
2012-08-28 07:42:28 +02:00
|
|
|
FakeSatellite.new
|
|
|
|
end
|
|
|
|
|
|
|
|
class FakeSatellite
|
|
|
|
def exists?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-01-28 16:39:02 +01:00
|
|
|
def destroy
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2012-08-28 07:42:28 +02:00
|
|
|
def create
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-01-04 07:43:25 +01:00
|
|
|
|
2013-01-04 20:45:30 +01:00
|
|
|
class GitLabTestRepo < Repository
|
2013-01-04 07:43:25 +01:00
|
|
|
def repo
|
|
|
|
@repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq'))
|
|
|
|
end
|
|
|
|
end
|