gitlab-org--gitlab-foss/spec/factories.rb

76 lines
1.8 KiB
Ruby
Raw Normal View History

2011-10-08 17:36:38 -04:00
require File.join(Rails.root, 'spec', 'factory')
Factory.add(:project, Project) do |obj|
obj.name = Faker::Internet.user_name
obj.path = 'gitlabhq'
2011-10-09 15:36:57 -04:00
obj.owner = Factory(:user)
2011-10-08 17:36:38 -04:00
obj.code = 'LGT'
end
Factory.add(:public_project, Project) do |obj|
obj.name = Faker::Internet.user_name
obj.path = 'gitlabhq'
2011-10-08 17:36:38 -04:00
obj.private_flag = false
2011-10-09 15:36:57 -04:00
obj.owner = Factory(:user)
2011-10-08 17:36:38 -04:00
obj.code = 'LGT'
end
Factory.add(:user, User) do |obj|
obj.email = Faker::Internet.email
obj.password = "123456"
obj.name = Faker::Name.name
obj.password_confirmation = "123456"
end
Factory.add(:admin, User) do |obj|
obj.email = Faker::Internet.email
obj.password = "123456"
obj.name = Faker::Name.name
obj.password_confirmation = "123456"
obj.admin = true
end
Factory.add(:issue, Issue) do |obj|
obj.title = Faker::Lorem.sentence
obj.author = Factory :user
obj.assignee = Factory :user
2011-10-08 17:36:38 -04:00
end
2011-11-28 13:42:32 -05:00
Factory.add(:merge_request, MergeRequest) do |obj|
obj.title = Faker::Lorem.sentence
obj.author = Factory :user
obj.assignee = Factory :user
2011-11-28 13:42:32 -05:00
obj.source_branch = "master"
obj.target_branch = "stable"
2011-12-15 16:21:29 -05:00
obj.closed = false
2011-11-28 13:42:32 -05:00
end
2011-10-16 17:07:10 -04:00
Factory.add(:snippet, Snippet) do |obj|
obj.title = Faker::Lorem.sentence
obj.file_name = Faker::Lorem.sentence
obj.content = Faker::Lorem.sentences
end
2011-10-08 17:36:38 -04:00
Factory.add(:note, Note) do |obj|
obj.note = Faker::Lorem.sentence
end
Factory.add(:key, Key) do |obj|
obj.title = "Example key"
obj.key = File.read(File.join(Rails.root, "db", "pkey.example"))
end
Factory.add(:web_hook, WebHook) do |obj|
obj.url = Faker::Internet.url
end
2012-02-21 12:18:06 -05:00
Factory.add(:wikis, WebHook) do |obj|
obj.title = Faker::Lorem.sentence
obj.content = Faker::Lorem.sentence
end
Factory.add(:event, Event) do |obj|
obj.title = Faker::Lorem.sentence
obj.project = Factory(:project)
end