debian-mirror-gitlab/spec/factories/projects.rb

93 lines
2.4 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
FactoryGirl.define do
2015-04-26 12:48:37 +05:30
# Project without repository
#
# Project does not have bare repository.
# Use this factory if you dont need repository in tests
2014-09-02 18:07:02 +05:30
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
2016-06-02 11:05:42 +05:30
trait :empty_repo do
after(:create) do |project|
project.create_repository
end
end
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
# Project with empty repository
2014-09-02 18:07:02 +05:30
#
2015-04-26 12:48:37 +05:30
# 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
2016-06-02 11:05:42 +05:30
empty_repo
2015-04-26 12:48:37 +05:30
end
# Project with test repository
#
# Test repository source can be found at
# https://gitlab.com/gitlab-org/gitlab-test
2014-09-02 18:07:02 +05:30
factory :project, parent: :empty_project do
path { 'gitlabhq' }
after :create do |project|
TestEnv.copy_repo(project)
end
end
2015-09-11 14:41:01 +05:30
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-09-02 18:07:02 +05:30
factory :redmine_project, parent: :project do
2015-04-26 12:48:37 +05:30
after :create do |project|
project.create_redmine_service(
active: true,
properties: {
'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-09-11 14:41:01 +05:30
2015-04-26 12:48:37 +05:30
project.issues_tracker = 'redmine'
project.issues_tracker_id = 'project_name_in_redmine'
end
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
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-09-02 18:07:02 +05:30
end