summaryrefslogtreecommitdiff
path: root/engines/support/test/factories.rb
blob: 7bc2ec765b595be18fa786078168a439ab651993 (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
FactoryBot.define do

  factory :ticket do
    subject { Faker::Lorem.sentence }
    email { "fake@example.org" }

    factory :ticket_with_comment do
      comments_attributes do
        { "0" => {
          "body" => Faker::Lorem.sentences.join(" "),
          "posted_by" => created_by
        } }
      end
    end

    factory :ticket_with_creator do
      created_by { FactoryBot.create(:user).id }
    end

  end

  # TicketComments can not be saved. so only use this with build
  # and add to a ticket afterwards
  factory :ticket_comment do
    body { Faker::Lorem.sentences.join(" ") }
  end

end