2014-08-25 05:25:02 -04:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: projects
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# name :string(255)
|
|
|
|
# path :string(255)
|
|
|
|
# description :text
|
|
|
|
# created_at :datetime
|
|
|
|
# updated_at :datetime
|
|
|
|
# creator_id :integer
|
|
|
|
# issues_enabled :boolean default(TRUE), not null
|
|
|
|
# wall_enabled :boolean default(TRUE), not null
|
|
|
|
# merge_requests_enabled :boolean default(TRUE), not null
|
|
|
|
# wiki_enabled :boolean default(TRUE), not null
|
|
|
|
# namespace_id :integer
|
|
|
|
# issues_tracker :string(255) default("gitlab"), not null
|
|
|
|
# issues_tracker_id :string(255)
|
|
|
|
# snippets_enabled :boolean default(TRUE), not null
|
|
|
|
# last_activity_at :datetime
|
|
|
|
# import_url :string(255)
|
|
|
|
# visibility_level :integer default(0), not null
|
|
|
|
# archived :boolean default(FALSE), not null
|
|
|
|
# import_status :string(255)
|
|
|
|
# repository_size :float default(0.0)
|
|
|
|
# star_count :integer default(0), not null
|
2015-01-22 12:40:03 -05:00
|
|
|
# import_type :string(255)
|
|
|
|
# import_source :string(255)
|
2015-02-02 13:24:40 -05:00
|
|
|
# avatar :string(255)
|
2014-08-25 05:25:02 -04:00
|
|
|
#
|
|
|
|
|
2014-07-31 13:13:27 -04:00
|
|
|
FactoryGirl.define do
|
2014-11-30 03:50:15 -05:00
|
|
|
# Project without repository
|
|
|
|
#
|
|
|
|
# Project does not have bare repository.
|
|
|
|
# Use this factory if you dont need repository in tests
|
2014-07-31 13:13:27 -04:00
|
|
|
factory :empty_project, class: 'Project' do
|
|
|
|
sequence(:name) { |n| "project#{n}" }
|
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
|
|
|
namespace
|
|
|
|
creator
|
|
|
|
snippets_enabled true
|
|
|
|
|
|
|
|
trait :public do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::PUBLIC
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :internal do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::INTERNAL
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :private do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::PRIVATE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-11-30 03:50:15 -05:00
|
|
|
# Project with empty repository
|
|
|
|
#
|
|
|
|
# This is a case when you just created a project
|
|
|
|
# but not pushed any code there yet
|
|
|
|
factory :project_empty_repo, parent: :empty_project do
|
|
|
|
after :create do |project|
|
|
|
|
project.create_repository
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Project with test repository
|
|
|
|
#
|
|
|
|
# Test repository source can be found at
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab-test
|
2014-07-31 13:13:27 -04:00
|
|
|
factory :project, parent: :empty_project do
|
|
|
|
path { 'gitlabhq' }
|
|
|
|
|
|
|
|
after :create do |project|
|
|
|
|
TestEnv.copy_repo(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-13 01:27:45 -04:00
|
|
|
factory :forked_project_with_submodules, parent: :empty_project do
|
|
|
|
path { 'forked-gitlabhq' }
|
|
|
|
|
|
|
|
after :create do |project|
|
|
|
|
TestEnv.copy_forked_repo_with_submodules(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-31 13:13:27 -04:00
|
|
|
factory :redmine_project, parent: :project do
|
2015-01-26 18:59:40 -05:00
|
|
|
after :create do |project|
|
|
|
|
project.create_redmine_service(
|
|
|
|
active: true,
|
|
|
|
properties: {
|
2015-01-27 01:08:27 -05:00
|
|
|
'project_url' => 'http://redmine/projects/project_name_in_redmine',
|
|
|
|
'issues_url' => "http://redmine/#{project.id}/project_name_in_redmine/:id",
|
|
|
|
'new_issue_url' => 'http://redmine/projects/project_name_in_redmine/issues/new'
|
2015-01-26 18:59:40 -05:00
|
|
|
}
|
|
|
|
)
|
2015-04-29 14:28:24 -04:00
|
|
|
|
2015-01-26 18:59:40 -05:00
|
|
|
project.issues_tracker = 'redmine'
|
|
|
|
project.issues_tracker_id = 'project_name_in_redmine'
|
|
|
|
end
|
2014-07-31 13:13:27 -04:00
|
|
|
end
|
2015-04-29 14:28:24 -04:00
|
|
|
|
|
|
|
factory :jira_project, parent: :project do
|
|
|
|
after :create do |project|
|
|
|
|
project.create_jira_service(
|
|
|
|
active: true,
|
|
|
|
properties: {
|
|
|
|
'title' => 'JIRA tracker',
|
|
|
|
'project_url' => 'http://jira.example/issues/?jql=project=A',
|
|
|
|
'issues_url' => 'http://jira.example/browse/:id',
|
|
|
|
'new_issue_url' => 'http://jira.example/secure/CreateIssue.jspa'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
project.issues_tracker = 'jira'
|
|
|
|
project.issues_tracker_id = 'project_name_in_jira'
|
|
|
|
end
|
|
|
|
end
|
2014-07-31 13:13:27 -04:00
|
|
|
end
|