2012-08-28 07:42:28 +02:00
|
|
|
FactoryGirl.define do
|
|
|
|
sequence :sentence, aliases: [:title, :content] do
|
|
|
|
Faker::Lorem.sentence
|
|
|
|
end
|
|
|
|
|
2012-08-29 17:36:02 +02:00
|
|
|
sequence :name, aliases: [:file_name] do
|
|
|
|
Faker::Name.name
|
|
|
|
end
|
|
|
|
|
2012-08-28 07:42:28 +02:00
|
|
|
sequence(:url) { Faker::Internet.uri('http') }
|
|
|
|
|
2013-01-02 18:00:00 +01:00
|
|
|
factory :user, aliases: [:author, :assignee, :owner, :creator] do
|
2012-08-28 07:42:28 +02:00
|
|
|
email { Faker::Internet.email }
|
2012-08-29 17:36:02 +02:00
|
|
|
name
|
2012-11-23 21:25:28 +01:00
|
|
|
username { Faker::Internet.user_name }
|
2012-08-28 07:42:28 +02:00
|
|
|
password "123456"
|
2012-09-04 06:04:36 +02:00
|
|
|
password_confirmation { password }
|
2012-08-28 07:42:28 +02:00
|
|
|
|
|
|
|
trait :admin do
|
|
|
|
admin true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :admin, traits: [:admin]
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :project do
|
|
|
|
sequence(:name) { |n| "project#{n}" }
|
2012-09-26 00:21:04 +02:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
2013-01-02 18:00:00 +01:00
|
|
|
creator
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
2012-11-23 19:53:24 +01:00
|
|
|
factory :group do
|
2012-10-02 17:20:46 +02:00
|
|
|
sequence(:name) { |n| "group#{n}" }
|
2012-11-23 19:31:09 +01:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
2012-10-02 17:20:46 +02:00
|
|
|
owner
|
2012-11-23 19:53:24 +01:00
|
|
|
type 'Group'
|
|
|
|
end
|
2012-11-22 20:41:16 +01:00
|
|
|
|
2012-11-23 19:53:24 +01:00
|
|
|
factory :namespace do
|
2013-01-02 18:32:34 +01:00
|
|
|
sequence(:name) { |n| "namespace#{n}" }
|
2012-11-23 19:53:24 +01:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
|
|
|
owner
|
2012-10-02 17:20:46 +02:00
|
|
|
end
|
|
|
|
|
2012-08-28 07:42:28 +02:00
|
|
|
factory :users_project do
|
|
|
|
user
|
|
|
|
project
|
2012-12-22 18:52:28 +01:00
|
|
|
project_access { UsersProject::MASTER }
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :issue do
|
|
|
|
title
|
|
|
|
author
|
|
|
|
project
|
|
|
|
|
|
|
|
trait :closed do
|
|
|
|
closed true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_issue, traits: [:closed]
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :merge_request do
|
|
|
|
title
|
|
|
|
author
|
|
|
|
project
|
|
|
|
source_branch "master"
|
|
|
|
target_branch "stable"
|
2012-10-10 00:25:29 +02:00
|
|
|
|
|
|
|
trait :closed do
|
|
|
|
closed true
|
|
|
|
end
|
|
|
|
|
2012-11-25 00:04:13 +01:00
|
|
|
# pick 3 commits "at random" (from bcf03b5d~3 to bcf03b5d)
|
|
|
|
trait :with_diffs do
|
2013-01-15 00:27:26 +01:00
|
|
|
target_branch "master" # pretend bcf03b5d~3
|
|
|
|
source_branch "stable" # pretend bcf03b5d
|
2012-11-25 00:04:13 +01:00
|
|
|
st_commits do
|
|
|
|
[Commit.new(project.repo.commit('bcf03b5d')),
|
|
|
|
Commit.new(project.repo.commit('bcf03b5d~1')),
|
|
|
|
Commit.new(project.repo.commit('bcf03b5d~2'))]
|
|
|
|
end
|
|
|
|
st_diffs do
|
|
|
|
project.repo.diff("bcf03b5d~3", "bcf03b5d")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-10-10 00:25:29 +02:00
|
|
|
factory :closed_merge_request, traits: [:closed]
|
2012-11-25 00:04:13 +01:00
|
|
|
factory :merge_request_with_diffs, traits: [:with_diffs]
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :note do
|
|
|
|
project
|
|
|
|
note "Note"
|
2012-10-30 03:27:36 +01:00
|
|
|
author
|
|
|
|
|
|
|
|
factory :note_on_commit, traits: [:on_commit]
|
2013-01-02 21:31:48 +01:00
|
|
|
factory :note_on_commit_diff, traits: [:on_commit, :on_diff]
|
2012-10-30 03:27:36 +01:00
|
|
|
factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
|
|
|
|
factory :note_on_merge_request, traits: [:on_merge_request]
|
2013-01-02 21:31:48 +01:00
|
|
|
factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff]
|
2012-10-30 03:27:36 +01:00
|
|
|
|
|
|
|
trait :on_commit do
|
2012-12-23 01:03:57 +01:00
|
|
|
commit_id "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
|
2012-10-30 03:27:36 +01:00
|
|
|
noteable_type "Commit"
|
|
|
|
end
|
|
|
|
|
2013-01-02 21:31:48 +01:00
|
|
|
trait :on_diff do
|
2012-10-30 03:27:36 +01:00
|
|
|
line_code "0_184_184"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_merge_request do
|
|
|
|
noteable_id 1
|
|
|
|
noteable_type "MergeRequest"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_issue do
|
2012-12-23 01:03:57 +01:00
|
|
|
noteable_id 1
|
2012-10-30 03:27:36 +01:00
|
|
|
noteable_type "Issue"
|
|
|
|
end
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :event do
|
2012-09-27 22:23:11 +02:00
|
|
|
factory :closed_issue_event do
|
|
|
|
project
|
|
|
|
action Event::Closed
|
|
|
|
target factory: :closed_issue
|
|
|
|
author factory: :user
|
|
|
|
end
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :key do
|
|
|
|
title
|
2012-08-29 03:15:21 +02:00
|
|
|
key do
|
2012-09-21 18:22:43 +02:00
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
2012-08-29 03:15:21 +02:00
|
|
|
end
|
2012-08-28 12:57:00 +02:00
|
|
|
|
|
|
|
factory :deploy_key do
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :personal_key do
|
|
|
|
user
|
|
|
|
end
|
2012-09-21 18:22:43 +02:00
|
|
|
|
|
|
|
factory :key_with_a_space_in_the_middle do
|
|
|
|
key do
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
|
|
|
end
|
|
|
|
end
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :milestone do
|
|
|
|
title
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :system_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :project_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :wiki do
|
|
|
|
title
|
|
|
|
content
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :snippet do
|
|
|
|
project
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
2012-08-29 17:36:02 +02:00
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|
2012-11-19 19:24:05 +01:00
|
|
|
|
|
|
|
factory :service do
|
|
|
|
type ""
|
|
|
|
title "GitLab CI"
|
|
|
|
token "x56olispAND34ng"
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :service_hook do
|
|
|
|
url
|
|
|
|
service
|
|
|
|
end
|
2012-08-28 07:42:28 +02:00
|
|
|
end
|