2013-06-26 10:32:34 -04:00
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
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') }
|
|
|
|
|
2013-01-02 12:00:00 -05:00
|
|
|
factory :user, aliases: [:author, :assignee, :owner, :creator] do
|
2012-08-28 01:42:28 -04:00
|
|
|
email { Faker::Internet.email }
|
2012-08-29 11:36:02 -04:00
|
|
|
name
|
2013-01-28 10:46:24 -05:00
|
|
|
sequence(:username) { |n| "#{Faker::Internet.user_name}#{n}" }
|
2013-11-25 13:07:55 -05:00
|
|
|
password "12345678"
|
2012-09-04 00:04:36 -04:00
|
|
|
password_confirmation { password }
|
2013-10-17 03:52:38 -04:00
|
|
|
confirmed_at { Time.now }
|
|
|
|
confirmation_token { nil }
|
2012-08-28 01:42:28 -04:00
|
|
|
|
|
|
|
trait :admin do
|
|
|
|
admin true
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :admin, traits: [:admin]
|
|
|
|
end
|
|
|
|
|
2014-01-22 14:03:52 -05:00
|
|
|
factory :empty_project, class: 'Project' do
|
2012-08-28 01:42:28 -04:00
|
|
|
sequence(:name) { |n| "project#{n}" }
|
2013-04-01 09:56:25 -04:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
2013-09-05 07:46:34 -04:00
|
|
|
namespace
|
2013-01-02 12:00:00 -05:00
|
|
|
creator
|
2014-03-19 05:14:27 -04:00
|
|
|
|
|
|
|
trait :public do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::PUBLIC
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :internal do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::INTERNAL
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :private do
|
|
|
|
visibility_level Gitlab::VisibilityLevel::PRIVATE
|
|
|
|
end
|
2013-02-11 06:41:12 -05:00
|
|
|
end
|
|
|
|
|
2014-02-20 09:09:30 -05:00
|
|
|
# Generates a test repository from the repository stored under `spec/seed_project.tar.gz`.
|
|
|
|
# Once you run `rake gitlab:setup`, you can see what the repository looks like under `tmp/repositories/gitlabhq`.
|
|
|
|
# In order to modify files in the repository, you must untar the seed, modify and remake the tar.
|
|
|
|
# Before recompressing, do not forget to `git checkout master`.
|
|
|
|
# After recompressing, you need to run `RAILS_ENV=test bundle exec rake gitlab:setup` to regenerate the seeds under tmp.
|
|
|
|
#
|
|
|
|
# If you want to modify the repository only for an specific type of tests, e.g., markdown tests,
|
|
|
|
# consider using a feature branch to reduce the chances of collision with other tests.
|
|
|
|
# Create a new commit, and use the same commit message that you will use for the change in the main repo.
|
|
|
|
# Changing the commig message and SHA of branch `master` may break tests.
|
2014-01-22 14:03:52 -05:00
|
|
|
factory :project, parent: :empty_project do
|
2013-04-01 09:56:25 -04:00
|
|
|
path { 'gitlabhq' }
|
2013-06-22 11:57:34 -04:00
|
|
|
|
|
|
|
after :create do |project|
|
2013-04-25 10:15:33 -04:00
|
|
|
TestEnv.clear_repo_dir(project.namespace, project.path)
|
2013-11-12 09:11:46 -05:00
|
|
|
TestEnv.reset_satellite_dir
|
2013-04-25 10:15:33 -04:00
|
|
|
TestEnv.create_repo(project.namespace, project.path)
|
2013-06-22 11:57:34 -04:00
|
|
|
end
|
2013-04-01 09:56:25 -04:00
|
|
|
end
|
|
|
|
|
2014-01-22 14:03:52 -05:00
|
|
|
factory :redmine_project, parent: :project do
|
|
|
|
issues_tracker { "redmine" }
|
|
|
|
issues_tracker_id { "project_name_in_redmine" }
|
|
|
|
end
|
|
|
|
|
2012-11-23 13:53:24 -05:00
|
|
|
factory :group do
|
2012-10-02 11:20:46 -04:00
|
|
|
sequence(:name) { |n| "group#{n}" }
|
2012-11-23 13:31:09 -05:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
2012-11-23 13:53:24 -05:00
|
|
|
type 'Group'
|
|
|
|
end
|
2012-11-22 14:41:16 -05:00
|
|
|
|
2012-11-23 13:53:24 -05:00
|
|
|
factory :namespace do
|
2013-01-02 12:32:34 -05:00
|
|
|
sequence(:name) { |n| "namespace#{n}" }
|
2012-11-23 13:53:24 -05:00
|
|
|
path { name.downcase.gsub(/\s/, '_') }
|
|
|
|
owner
|
2012-10-02 11:20:46 -04:00
|
|
|
end
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
factory :users_project do
|
|
|
|
user
|
|
|
|
project
|
2012-12-22 12:52:28 -05:00
|
|
|
project_access { UsersProject::MASTER }
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :issue do
|
|
|
|
title
|
|
|
|
author
|
|
|
|
project
|
|
|
|
|
|
|
|
trait :closed do
|
2013-02-18 04:10:58 -05:00
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :reopened do
|
|
|
|
state :reopened
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_issue, traits: [:closed]
|
2013-02-18 04:10:58 -05:00
|
|
|
factory :reopened_issue, traits: [:reopened]
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :merge_request do
|
|
|
|
title
|
|
|
|
author
|
2014-01-22 14:03:52 -05:00
|
|
|
source_project factory: :project
|
|
|
|
target_project { source_project }
|
2014-01-23 05:55:43 -05:00
|
|
|
|
|
|
|
# → git log stable..master --pretty=oneline
|
|
|
|
# b1e6a9dbf1c85e6616497a5e7bad9143a4bd0828 tree css fixes
|
|
|
|
# 8716fc78f3c65bbf7bcf7b574febd583bc5d2812 Added loading animation for notes
|
|
|
|
# cd5c4bac5042c5469dcdf7e7b2f768d3c6fd7088 notes count for wall
|
|
|
|
# 8470d70da67355c9c009e4401746b1d5410af2e3 notes controller refactored
|
|
|
|
# 1e689bfba39525ead225eaf611948cfbe8ac34cf fixed notes logic
|
|
|
|
# f0f14c8eaba69ebddd766498a9d0b0e79becd633 finished scss refactoring
|
|
|
|
# 3a4b4fb4cde7809f033822a171b9feae19d41fff Moving ui styles to one scss file, Added ui class to body
|
|
|
|
# 065c200c33f68c2bb781e35a43f9dc8138a893b5 removed unnecessary hr tags & titles
|
|
|
|
# 1e8b111be85df0db6c8000ef9a710bc0221eae83 Merge branch 'master' of github.com:gitlabhq/gitlabhq
|
|
|
|
# f403da73f5e62794a0447aca879360494b08f678 Fixed ajax loading image. Fixed wrong wording
|
|
|
|
# e6ea73c77600d413d370249b8e392734f7d1dbee Merge pull request #468 from bencevans/patch-1
|
|
|
|
# 4a3c05b69355deee25767a74d0512ec4b510d4ef Merge pull request #470 from bgondy/patch-1
|
|
|
|
# 0347fe2412eb51d3efeccc35210e9268bc765ac5 Update app/views/projects/team.html.haml
|
|
|
|
# 2b5c61bdece1f7eb2b901ceea7d364065cdf76ac Title for a link fixed
|
|
|
|
# 460eeb13b7560b40104044973ff933b1a6dbbcaa Increased count of notes loaded when visit wall page
|
|
|
|
# 21c141afb1c53a9180a99d2cca29ffa613eb7e3a Merge branch 'notes_refactoring'
|
|
|
|
# 292a41cbe295f16f7148913b31eb0fb91f3251c3 Fixed comments for snippets. Tests fixed
|
|
|
|
# d41d8ffb02fa74fd4571603548bd7e401ec99e0c Reply button, Comments for Merge Request diff
|
|
|
|
# b1a36b552be2a7a6bc57fbed6c52dc6ed82111f8 Merge pull request #466 from skroutz/no-rbenv
|
|
|
|
# db75dae913e8365453ca231f101b067314a7ea71 Merge pull request #465 from skroutz/branches_commit_link
|
|
|
|
# 75f040fbfe4b5af23ff004ad3207c3976df097a8 Don't enforce rbenv version
|
|
|
|
# e42fb4fda475370dcb0d8f8f1268bfdc7a0cc437 Fix broken commit link in branches page
|
|
|
|
# 215a01f63ccdc085f75a48f6f7ab6f2b15b5852c move notes login to one controller
|
|
|
|
# 81092c01984a481e312de10a28e3f1a6dda182a3 Status codes for errors, New error pages
|
|
|
|
# 7d279f9302151e3c8f4c5df9c5200a72799409b9 better error handling for not found resource, gitolite error
|
|
|
|
# 9e6d0710e927aa8ea834b8a9ae9f277be617ac7d Merge pull request #443 from CedricGatay/fix/incorrectLineNumberingInDiff
|
|
|
|
# 6ea87c47f0f8a24ae031c3fff17bc913889ecd00 Incorrect line numbering in diff
|
|
|
|
#
|
|
|
|
# → git log master..stable --pretty=oneline
|
|
|
|
# empty
|
|
|
|
|
2012-08-28 01:42:28 -04:00
|
|
|
source_branch "master"
|
|
|
|
target_branch "stable"
|
2012-10-09 18:25:29 -04:00
|
|
|
|
2012-11-24 18:04:13 -05:00
|
|
|
trait :with_diffs do
|
|
|
|
end
|
|
|
|
|
2013-02-18 03:40:56 -05:00
|
|
|
trait :closed do
|
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :reopened do
|
|
|
|
state :reopened
|
|
|
|
end
|
|
|
|
|
2014-03-18 21:32:40 -04:00
|
|
|
trait :simple do
|
|
|
|
source_branch "simple_merge_request"
|
|
|
|
target_branch "master"
|
|
|
|
end
|
|
|
|
|
2012-10-09 18:25:29 -04:00
|
|
|
factory :closed_merge_request, traits: [:closed]
|
2013-02-18 03:40:56 -05:00
|
|
|
factory :reopened_merge_request, traits: [:reopened]
|
2012-11-24 18:04:13 -05:00
|
|
|
factory :merge_request_with_diffs, traits: [:with_diffs]
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :note do
|
|
|
|
project
|
|
|
|
note "Note"
|
2012-10-29 22:27:36 -04:00
|
|
|
author
|
|
|
|
|
|
|
|
factory :note_on_commit, traits: [:on_commit]
|
2013-01-02 15:31:48 -05:00
|
|
|
factory :note_on_commit_diff, traits: [:on_commit, :on_diff]
|
2012-10-29 22:27:36 -04:00
|
|
|
factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note]
|
|
|
|
factory :note_on_merge_request, traits: [:on_merge_request]
|
2013-01-02 15:31:48 -05:00
|
|
|
factory :note_on_merge_request_diff, traits: [:on_merge_request, :on_diff]
|
2012-10-29 22:27:36 -04:00
|
|
|
|
|
|
|
trait :on_commit do
|
2014-01-22 14:03:52 -05:00
|
|
|
project factory: :project
|
2013-04-25 10:15:33 -04:00
|
|
|
commit_id "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
|
2012-10-29 22:27:36 -04:00
|
|
|
noteable_type "Commit"
|
|
|
|
end
|
|
|
|
|
2013-01-02 15:31:48 -05:00
|
|
|
trait :on_diff do
|
2012-10-29 22:27:36 -04:00
|
|
|
line_code "0_184_184"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_merge_request do
|
2014-01-22 14:03:52 -05:00
|
|
|
project factory: :project
|
2013-04-25 10:15:33 -04:00
|
|
|
noteable_id 1
|
2012-10-29 22:27:36 -04:00
|
|
|
noteable_type "MergeRequest"
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :on_issue do
|
2013-04-25 10:15:33 -04:00
|
|
|
noteable_id 1
|
2012-10-29 22:27:36 -04:00
|
|
|
noteable_type "Issue"
|
|
|
|
end
|
2013-06-26 10:32:34 -04:00
|
|
|
|
|
|
|
trait :with_attachment do
|
|
|
|
attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png") }
|
|
|
|
end
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :event do
|
2012-09-27 16:23:11 -04:00
|
|
|
factory :closed_issue_event do
|
|
|
|
project
|
2013-02-13 06:48:16 -05:00
|
|
|
action { Event::CLOSED }
|
2012-09-27 16:23:11 -04:00
|
|
|
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
|
|
|
|
2013-05-06 08:09:26 -04:00
|
|
|
factory :deploy_key, class: 'DeployKey' do
|
2012-08-28 06:57:00 -04:00
|
|
|
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
|
2013-02-15 04:31:05 -05:00
|
|
|
|
2014-02-11 13:15:13 -05: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 04:31:05 -05:00
|
|
|
factory :invalid_key do
|
|
|
|
key do
|
|
|
|
"ssh-rsa this_is_invalid_key=="
|
|
|
|
end
|
|
|
|
end
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
2014-02-08 22:08:49 -05: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 01:42:28 -04:00
|
|
|
|
|
|
|
factory :milestone do
|
|
|
|
title
|
|
|
|
project
|
2013-02-18 04:38:29 -05:00
|
|
|
|
|
|
|
trait :closed do
|
|
|
|
state :closed
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :closed_milestone, traits: [:closed]
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
factory :system_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :project_hook do
|
|
|
|
url
|
|
|
|
end
|
|
|
|
|
2013-03-24 14:31:14 -04:00
|
|
|
factory :project_snippet do
|
2012-08-28 01:42:28 -04:00
|
|
|
project
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
2012-08-29 11:36:02 -04:00
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2013-03-24 18:18:03 -04:00
|
|
|
factory :personal_snippet do
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2013-03-24 14:31:14 -04:00
|
|
|
factory :snippet do
|
|
|
|
author
|
|
|
|
title
|
|
|
|
content
|
|
|
|
file_name
|
|
|
|
end
|
|
|
|
|
2012-08-29 11:36:02 -04:00
|
|
|
factory :protected_branch do
|
|
|
|
name
|
|
|
|
project
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|
2012-11-19 13:24:05 -05:00
|
|
|
|
|
|
|
factory :service do
|
|
|
|
type ""
|
|
|
|
title "GitLab CI"
|
|
|
|
token "x56olispAND34ng"
|
|
|
|
project
|
|
|
|
end
|
|
|
|
|
|
|
|
factory :service_hook do
|
|
|
|
url
|
|
|
|
service
|
|
|
|
end
|
2013-05-06 08:09:26 -04:00
|
|
|
|
|
|
|
factory :deploy_keys_project do
|
|
|
|
deploy_key
|
|
|
|
project
|
|
|
|
end
|
2012-08-28 01:42:28 -04:00
|
|
|
end
|