2013-01-04 14:45:30 -05:00
|
|
|
require "repository"
|
|
|
|
require "project"
|
2013-02-21 04:44:33 -05:00
|
|
|
require "merge_request"
|
2013-02-04 11:18:36 -05:00
|
|
|
require "shell"
|
2013-01-04 14:45:30 -05:00
|
|
|
|
2012-08-28 01:42:28 -04: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 17:01:08 -05:00
|
|
|
class Project
|
2013-01-04 14:45:30 -05:00
|
|
|
def repository
|
|
|
|
if path == "empty" || !path
|
|
|
|
nil
|
|
|
|
else
|
|
|
|
GitLabTestRepo.new(path_with_namespace)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-29 01:55:41 -04:00
|
|
|
def satellite
|
2012-08-28 01:42:28 -04:00
|
|
|
FakeSatellite.new
|
|
|
|
end
|
|
|
|
|
|
|
|
class FakeSatellite
|
|
|
|
def exists?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-01-28 10:39:02 -05:00
|
|
|
def destroy
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
def create
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-01-04 01:43:25 -05:00
|
|
|
|
2013-02-21 04:44:33 -05:00
|
|
|
class MergeRequest
|
2013-02-21 05:27:52 -05:00
|
|
|
def check_if_can_be_merged
|
2013-02-21 04:44:33 -05:00
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-01-04 14:45:30 -05:00
|
|
|
class GitLabTestRepo < Repository
|
2013-01-04 01:43:25 -05:00
|
|
|
def repo
|
|
|
|
@repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq'))
|
|
|
|
end
|
2013-03-07 04:45:44 -05:00
|
|
|
|
|
|
|
# patch repo size (in mb)
|
|
|
|
def size
|
|
|
|
12.45
|
|
|
|
end
|
2013-01-04 01:43:25 -05:00
|
|
|
end
|
2013-02-04 11:18:36 -05:00
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class Shell
|
|
|
|
def add_repository name
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-03-12 12:59:25 -04:00
|
|
|
def mv_repository name, new_name
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-02-04 11:18:36 -05:00
|
|
|
def remove_repository name
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-02-05 05:47:50 -05:00
|
|
|
def add_key id, key
|
2013-02-04 11:18:36 -05:00
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2013-02-05 05:47:50 -05:00
|
|
|
def remove_key id, key
|
2013-02-04 11:18:36 -05:00
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|