summaryrefslogtreecommitdiff
path: root/spec/factories/snippets.rb
blob: dc12b562108ab38e4b9ae5316e3f7c447c9b0cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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