Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/factories/timelogs.rb')
-rw-r--r--spec/factories/timelogs.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/factories/timelogs.rb b/spec/factories/timelogs.rb
index 5d34acc635d..204cb808c8e 100644
--- a/spec/factories/timelogs.rb
+++ b/spec/factories/timelogs.rb
@@ -1,11 +1,22 @@
# frozen_string_literal: true
-# Read about factories at https://github.com/thoughtbot/factory_bot
-
FactoryBot.define do
factory :timelog do
time_spent { 3600 }
- issue
- user { issue.project.creator }
+ 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