2012-08-28 01:42:28 -04:00
|
|
|
# Backwards compatibility with the old method
|
|
|
|
def Factory(type, *args)
|
|
|
|
FactoryGirl.create(type, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
module Factory
|
|
|
|
def self.create(type, *args)
|
|
|
|
FactoryGirl.create(type, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.new(type, *args)
|
|
|
|
FactoryGirl.build(type, *args)
|
|
|
|
end
|
2012-09-04 02:38:48 -04:00
|
|
|
def self.attributes(type, *args)
|
|
|
|
FactoryGirl.attributes_for(type, *args)
|
|
|
|
end
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
FactoryGirl.define do
|
|
|
|
sequence :sentence, aliases: [:title, :content] do
|
|
|
|
Faker::Lorem.sentence
|
|
|
|
end
|
|
|
|
|
2012-08-29 11:36:02 -04:00
|
|
|
sequence :name, aliases: [:file_name] do
|
|
|
|
Faker::Name.name
|
|
|
|
end
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
sequence(:url) { Faker::Internet.uri('http') }
|
|
|
|
|
|
|
|
factory :user, aliases: [:author, :assignee, :owner] do
|
|
|
|
email { Faker::Internet.email }
|
2012-08-29 11:36:02 -04:00
|
|
|
name
|
2012-08-28 01:42:28 -04:00
|
|
|
password "123456"
|
2012-09-04 00:04:36 -04:00
|
|
|
password_confirmation { password }
|
2012-08-28 01:42:28 -04:00
|
|
|
|
|
|
|
trait :admin do
|
|
|
|
admin true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :admin, traits: [:admin]
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :project do
|
|
|
|
sequence(:name) { |n| "project#{n}" }
|
2012-09-25 18:21:04 -04:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
|
|
|
code { name.downcase.gsub(/\s/, '_') }
|
2012-08-28 01:42:28 -04:00
|
|
|
owner
|
|
|
|
end
|
|
|
|
|
2012-10-02 11:20:46 -04:00
|
|
|
factory :group do
|
|
|
|
sequence(:name) { |n| "group#{n}" }
|
|
|
|
code { name.downcase.gsub(/\s/, '_') }
|
|
|
|
owner
|
|
|
|
end
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
factory :users_project do
|
|
|
|
user
|
|
|
|
project
|
|
|
|
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-09 18:25:29 -04:00
|
|
|
|
|
|
|
trait :closed do
|
|
|
|
closed true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_merge_request, traits: [:closed]
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :note do
|
|
|
|
project
|
|
|
|
note "Note"
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :event do
|
2012-09-27 16:23:11 -04:00
|
|
|
factory :closed_issue_event do
|
|
|
|
project
|
|
|
|
action Event::Closed
|
|
|
|
target factory: :closed_issue
|
|
|
|
author factory: :user
|
|
|
|
end
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :key do
|
|
|
|
title
|
2012-08-28 21:15:21 -04:00
|
|
|
key do
|
2012-09-21 12:22:43 -04:00
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
2012-08-28 21:15:21 -04:00
|
|
|
end
|
2012-08-28 06:57:00 -04:00
|
|
|
|
|
|
|
factory :deploy_key do
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :personal_key do
|
|
|
|
user
|
|
|
|
end
|
2012-09-21 12:22:43 -04:00
|
|
|
|
|
|
|
factory :key_with_a_space_in_the_middle do
|
|
|
|
key do
|
|
|
|
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa ++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
|
|
|
|
end
|
|
|
|
end
|
2012-08-28 01:42:28 -04: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 11:36:02 -04:00
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
end
|