gitlab-org--gitlab-foss/spec/factories/groups.rb
Gosia Ksionek 64858317ad Add part of needed code
Add columns to store project creation settings

Add project creation level column in groups
 and default project creation column in application settings

Remove obsolete line from schema

Update migration with project_creation_level column existence check

Rename migrations to avoid conflicts

Update migration methods

Update migration method
2019-04-05 18:49:46 +00:00

49 lines
1.2 KiB
Ruby

FactoryBot.define do
factory :group, class: Group, parent: :namespace do
sequence(:name) { |n| "group#{n}" }
path { name.downcase.gsub(/\s/, '_') }
type 'Group'
owner nil
project_creation_level ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS
after(:create) do |group|
if group.owner
# We could remove this after we have proper constraint:
# https://gitlab.com/gitlab-org/gitlab-ce/issues/43292
raise "Don't set owner for groups, use `group.add_owner(user)` instead"
end
end
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
trait :with_avatar do
avatar { fixture_file_upload('spec/fixtures/dk.png') }
end
trait :access_requestable do
request_access_enabled true
end
trait :nested do
parent factory: :group
end
trait :auto_devops_enabled do
auto_devops_enabled true
end
trait :auto_devops_disabled do
auto_devops_enabled false
end
end
end