summaryrefslogtreecommitdiff
path: root/spec/factories/projects.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-31 20:13:27 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-31 20:13:27 +0300
commitcbe4891d7c44d59c902d13315eb3140fb6d47486 (patch)
tree83c35728846a48e1b498ed720c311e342f7f481a /spec/factories/projects.rb
parent2a6fc1c5debc81ac883bad4e7f9748be88a9b9ff (diff)
downloadgitlab-ce-cbe4891d7c44d59c902d13315eb3140fb6d47486.tar.gz
Fix form mr tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/factories/projects.rb')
-rw-r--r--spec/factories/projects.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
new file mode 100644
index 00000000000..353d9d645ef
--- /dev/null
+++ b/spec/factories/projects.rb
@@ -0,0 +1,44 @@
+FactoryGirl.define do
+ factory :empty_project, class: 'Project' do
+ sequence(:name) { |n| "project#{n}" }
+ path { name.downcase.gsub(/\s/, '_') }
+ namespace
+ creator
+ snippets_enabled true
+
+ 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
+ end
+
+ # 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.
+ factory :project, parent: :empty_project do
+ path { 'gitlabhq' }
+
+ after :create do |project|
+ TestEnv.copy_repo(project)
+ end
+ end
+
+ factory :redmine_project, parent: :project do
+ issues_tracker { "redmine" }
+ issues_tracker_id { "project_name_in_redmine" }
+ end
+end