Commit 5c1496a4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve project factories

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent f7d8467a
...@@ -131,7 +131,7 @@ module SharedProject ...@@ -131,7 +131,7 @@ module SharedProject
end end
step 'public empty project "Empty Public Project"' do 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 end
step 'project "Community" has comments' do step 'project "Community" has comments' do
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
# #
FactoryGirl.define do 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 factory :empty_project, class: 'Project' do
sequence(:name) { |n| "project#{n}" } sequence(:name) { |n| "project#{n}" }
path { name.downcase.gsub(/\s/, '_') } path { name.downcase.gsub(/\s/, '_') }
...@@ -47,6 +51,20 @@ FactoryGirl.define do ...@@ -47,6 +51,20 @@ FactoryGirl.define do
end end
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 factory :project, parent: :empty_project do
path { 'gitlabhq' } path { 'gitlabhq' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment