4af9d592c5
I've followed the [upgrade guide](https://github.com/thoughtbot/factory_bot/blob/4-9-0-stable/UPGRADE_FROM_FACTORY_GIRL.md) and ran these two commands: ``` grep -e FactoryGirl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|FactoryGirl|FactoryBot|" grep -e factory_girl **/*.rake **/*.rb -s -l | xargs sed -i "" "s|factory_girl|factory_bot|" ``` Signed-off-by: Rémy Coutable <remy@rymai.me>
32 lines
698 B
Ruby
32 lines
698 B
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
|
|
|
|
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 { File.open(Rails.root.join('spec/fixtures/dk.png')) }
|
|
end
|
|
|
|
trait :access_requestable do
|
|
request_access_enabled true
|
|
end
|
|
|
|
trait :nested do
|
|
parent factory: :group
|
|
end
|
|
end
|
|
end
|