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
|
2012-08-29 07:55:41 +02:00
|
|
|
def path_to_repo
|
2012-08-29 02:57:54 +02:00
|
|
|
if new_record? || path == 'newproject'
|
|
|
|
# There are a couple Project specs and features that expect the Project's
|
|
|
|
# path to be in the returned path, so let's patronize them.
|
2012-09-26 20:52:01 +02:00
|
|
|
Rails.root.join('tmp', 'repositories', path)
|
2012-08-28 07:42:28 +02:00
|
|
|
else
|
|
|
|
# For everything else, just give it the path to one of our real seeded
|
|
|
|
# repos.
|
2012-09-26 20:52:01 +02:00
|
|
|
Rails.root.join('tmp', 'repositories', 'gitlabhq')
|
2012-08-28 07:42:28 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
def create
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|