summaryrefslogtreecommitdiff
path: root/spec/factories/timelogs.rb
blob: 204cb808c8ee5026bd26394d93c9eac5516e5a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

FactoryBot.define do
  factory :timelog do
    time_spent { 3600 }
    for_issue

    factory :issue_timelog,         traits: [:for_issue]
    factory :merge_request_timelog, traits: [:for_merge_request]

    trait :for_issue do
      issue
      user { issue.author }
    end

    trait :for_merge_request do
      merge_request
      issue { nil }
      user { merge_request.author }
    end
  end
end