2013-06-26 14:32:34 +00:00
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2012-08-28 05:42:28 +00:00
|
|
|
FactoryGirl.define do
|
|
|
|
sequence :sentence, aliases: [:title, :content] do
|
|
|
|
Faker::Lorem.sentence
|
|
|
|
end
|
|
|
|
|
2012-08-29 15:36:02 +00:00
|
|
|
sequence :name, aliases: [:file_name] do
|
|
|
|
Faker::Name.name
|
|
|
|
end
|
|
|
|
|
2012-08-28 05:42:28 +00:00
|
|
|
sequence(:url) { Faker::Internet.uri('http') }
|
|
|
|
|
2013-01-02 17:00:00 +00:00
|
|
|
factory :user, aliases: [:author, :assignee, :owner, :creator] do
|
2012-08-28 05:42:28 +00:00
|
|
|
email { Faker::Internet.email }
|
2012-08-29 15:36:02 +00:00
|
|
|
name
|
2013-01-28 15:46:24 +00:00
|
|
|
sequence(:username) { |n| "#{Faker::Internet.user_name}#{n}" }
|
2013-11-25 18:07:55 +00:00
|
|
|
password "12345678"
|
2012-09-04 04:04:36 +00:00
|
|
|
password_confirmation { password }
|
2013-10-17 07:52:38 +00:00
|
|
|
confirmed_at { Time.now }
|
|
|
|
confirmation_token { nil }
|
2012-08-28 05:42:28 +00:00
|
|
|
|
|
|
|
trait :admin do
|
|
|
|
admin true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :admin, traits: [:admin]
|
|
|
|
end
|
|
|
|
|
2012-11-23 18:53:24 +00:00
|
|
|
factory :group do
|
2012-10-02 15:20:46 +00:00
|
|
|
sequence(:name) { |n| "group#{n}" }
|
2012-11-23 18:31:09 +00:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
2012-11-23 18:53:24 +00:00
|
|
|
type 'Group'
|
|
|
|
end
|
2012-11-22 19:41:16 +00:00
|
|
|
|
2012-11-23 18:53:24 +00:00
|
|
|
factory :namespace do
|
2013-01-02 17:32:34 +00:00
|
|
|
sequence(:name) { |n| "namespace#{n}" }
|
2012-11-23 18:53:24 +00:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
|
|
|
owner
|
2012-10-02 15:20:46 +00:00
|
|
|
end
|
|
|
|
|
2012-08-28 05:42:28 +00:00
|
|
|
factory :users_project do
|
|
|
|
user
|
|
|
|
project
|
2012-12-22 17:52:28 +00:00
|
|
|
project_access { UsersProject::MASTER }
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :issue do
|
|
|
|
title
|
|
|
|
author
|
|
|
|
project
|
|
|
|
|
|
|
|
trait :closed do
|
2013-02-18 09:10:58 +00:00
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :reopened do
|
|
|
|
state :reopened
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_issue, traits: [:closed]
|
2013-02-18 09:10:58 +00:00
|
|
|
factory :reopened_issue, traits: [:reopened]
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :event do
|
2012-09-27 20:23:11 +00:00
|
|
|
factory :closed_issue_event do
|
|
|
|
project
|
2013-02-13 11:48:16 +00:00
|
|
|
action { Event::CLOSED }
|
2012-09-27 20:23:11 +00:00
|
|
|
target factory: :closed_issue
|
|
|
|
author factory: :user
|
|
|
|
end
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :key do
|
|
|
|
title
|
2012-08-29 01:15:21 +00:00
|
|
|
key do
|
2012-09-21 16:22:43 +00:00
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
2012-08-29 01:15:21 +00:00
|
|
|
end
|
2012-08-28 10:57:00 +00:00
|
|
|
|
2013-05-06 12:09:26 +00:00
|
|
|
factory :deploy_key, class: 'DeployKey' do
|
2012-08-28 10:57:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :personal_key do
|
|
|
|
user
|
|
|
|
end
|
2012-09-21 16:22:43 +00:00
|
|
|
|
|
|
|
factory :key_with_a_space_in_the_middle do
|
|
|
|
key do
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
|
|
|
end
|
|
|
|
end
|
2013-02-15 09:31:05 +00:00
|
|
|
|
2014-02-11 18:15:13 +00:00
|
|
|
factory :another_key do
|
|
|
|
key do
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmTillFzNTrrGgwaCKaSj+QCz81E6jBc/s9av0+3b1Hwfxgkqjl4nAK/OD2NjgyrONDTDfR8cRN4eAAy6nY8GLkOyYBDyuc5nTMqs5z3yVuTwf3koGm/YQQCmo91psZ2BgDFTor8SVEE5Mm1D1k3JDMhDFxzzrOtRYFPci9lskTJaBjpqWZ4E9rDTD2q/QZntCqbC3wE9uSemRQB5f8kik7vD/AD8VQXuzKladrZKkzkONCPWsXDspUitjM8HkQdOf0PsYn1CMUC1xKYbCxkg5TkEosIwGv6CoEArUrdu/4+10LVslq494mAvEItywzrluCLCnwELfW+h/m8UHoVhZ"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-02-15 09:31:05 +00:00
|
|
|
factory :invalid_key do
|
|
|
|
key do
|
|
|
|
"ssh-rsa this_is_invalid_key=="
|
|
|
|
end
|
|
|
|
end
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
2014-06-30 11:02:52 +00:00
|
|
|
|
2014-02-09 03:08:49 +00:00
|
|
|
factory :email do
|
|
|
|
user
|
|
|
|
email do
|
|
|
|
Faker::Internet.email('alias')
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :another_email do
|
|
|
|
email do
|
|
|
|
Faker::Internet.email('another.alias')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-08-28 05:42:28 +00:00
|
|
|
|
|
|
|
factory :milestone do
|
|
|
|
title
|
|
|
|
project
|
2013-02-18 09:38:29 +00:00
|
|
|
|
|
|
|
trait :closed do
|
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_milestone, traits: [:closed]
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :system_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :project_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
2013-03-24 18:31:14 +00:00
|
|
|
factory :project_snippet do
|
2012-08-28 05:42:28 +00:00
|
|
|
project
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
2012-08-29 15:36:02 +00:00
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2013-03-24 22:18:03 +00:00
|
|
|
factory :personal_snippet do
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2013-03-24 18:31:14 +00:00
|
|
|
factory :snippet do
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2012-08-29 15:36:02 +00:00
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|
2012-11-19 18:24:05 +00:00
|
|
|
|
|
|
|
factory :service do
|
|
|
|
type ""
|
|
|
|
title "GitLab CI"
|
|
|
|
token "x56olispAND34ng"
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :service_hook do
|
|
|
|
url
|
|
|
|
service
|
|
|
|
end
|
2013-05-06 12:09:26 +00:00
|
|
|
|
|
|
|
factory :deploy_keys_project do
|
|
|
|
deploy_key
|
|
|
|
project
|
|
|
|
end
|
2012-08-28 05:42:28 +00:00
|
|
|
end
|