gitlab-org--gitlab-foss/spec/factories/snippets.rb
Rémy Coutable a2718ebaff Make user/author use project.creator in most factories
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-01-31 18:31:21 +01:00

29 lines
619 B
Ruby

FactoryBot.define do
factory :snippet do
author
title { generate(:title) }
content { generate(:title) }
description { generate(:title) }
file_name { generate(:filename) }
trait :public do
visibility_level Snippet::PUBLIC
end
trait :internal do
visibility_level Snippet::INTERNAL
end
trait :private do
visibility_level Snippet::PRIVATE
end
end
factory :project_snippet, parent: :snippet, class: :ProjectSnippet do
project
author { project.creator }
end
factory :personal_snippet, parent: :snippet, class: :PersonalSnippet do
end
end