gitlabhq/spec/factories.rb

131 lines
2 KiB
Ruby
Raw Normal View History

# Backwards compatibility with the old method
def Factory(type, *args)
FactoryGirl.create(type, *args)
2011-10-08 23:36:38 +02:00
end
module Factory
def self.create(type, *args)
FactoryGirl.create(type, *args)
end
2012-07-18 23:24:37 +02:00
def self.new(type, *args)
FactoryGirl.build(type, *args)
end
2011-10-08 23:36:38 +02:00
end
FactoryGirl.define do
sequence :sentence, aliases: [:title, :content] do
Faker::Lorem.sentence
end
2011-10-08 23:36:38 +02:00
sequence :name, aliases: [:file_name] do
Faker::Name.name
end
2011-10-08 23:36:38 +02:00
sequence(:url) { Faker::Internet.uri('http') }
2011-10-08 23:36:38 +02:00
factory :user, aliases: [:author, :assignee, :owner] do
email { Faker::Internet.email }
name
password "123456"
password_confirmation "123456"
2011-11-28 19:42:32 +01:00
trait :admin do
admin true
end
2011-10-16 23:07:10 +02:00
factory :admin, traits: [:admin]
end
2011-10-08 23:36:38 +02:00
factory :project do
sequence(:name) { |n| "project#{n}" }
path { name }
code { name }
owner
end
factory :users_project do
user
project
end
2012-02-21 18:18:06 +01:00
factory :issue do
title
author
project
2012-07-18 23:24:37 +02:00
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"
end
factory :note do
project
note "Note"
end
factory :event do
end
factory :key do
title
key do
"""
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=
"""
end
factory :deploy_key do
project
end
factory :personal_key do
user
end
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
file_name
end
2012-04-09 00:01:42 +02:00
factory :protected_branch do
name
project
end
2012-04-09 00:01:42 +02:00
end