Improve project factories

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-11-30 10:50:15 +02:00
parent f7d8467af9
commit 5c1496a4d8
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
2 changed files with 19 additions and 1 deletions

View file

@ -131,7 +131,7 @@ module SharedProject
end
step 'public empty project "Empty Public Project"' do
create :empty_project, :public, name: "Empty Public Project"
create :project_empty_repo, :public, name: "Empty Public Project"
end
step 'project "Community" has comments' do

View file

@ -27,6 +27,10 @@
#
FactoryGirl.define do
# Project without repository
#
# Project does not have bare repository.
# Use this factory if you dont need repository in tests
factory :empty_project, class: 'Project' do
sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') }
@ -47,6 +51,20 @@ FactoryGirl.define do
end
end
# Project with empty repository
#
# This is a case when you just created a project
# but not pushed any code there yet
factory :project_empty_repo, parent: :empty_project do
after :create do |project|
project.create_repository
end
end
# Project with test repository
#
# Test repository source can be found at
# https://gitlab.com/gitlab-org/gitlab-test
factory :project, parent: :empty_project do
path { 'gitlabhq' }