debian-mirror-gitlab/spec/factories/todos.rb

58 lines
1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
FactoryBot.define do
2016-04-02 18:10:28 +05:30
factory :todo do
2017-09-10 17:25:29 +05:30
project
2018-11-18 11:00:15 +05:30
author { project&.creator || user }
user { project&.creator || user }
2016-04-02 18:10:28 +05:30
target factory: :issue
action { Todo::ASSIGNED }
trait :assigned do
action { Todo::ASSIGNED }
end
trait :mentioned do
action { Todo::MENTIONED }
end
2016-06-02 11:05:42 +05:30
2017-08-17 22:00:37 +05:30
trait :directly_addressed do
action { Todo::DIRECTLY_ADDRESSED }
2016-06-02 11:05:42 +05:30
end
trait :build_failed do
action { Todo::BUILD_FAILED }
2017-08-17 22:00:37 +05:30
target factory: :merge_request
end
trait :marked do
action { Todo::MARKED }
2016-06-02 11:05:42 +05:30
end
2016-08-24 12:49:21 +05:30
trait :approval_required do
action { Todo::APPROVAL_REQUIRED }
end
2017-08-17 22:00:37 +05:30
trait :unmergeable do
action { Todo::UNMERGEABLE }
end
trait :pending do
2019-12-21 20:55:43 +05:30
state { :pending }
2017-08-17 22:00:37 +05:30
end
2016-08-24 12:49:21 +05:30
trait :done do
2019-12-21 20:55:43 +05:30
state { :done }
2016-08-24 12:49:21 +05:30
end
2016-04-02 18:10:28 +05:30
end
2017-08-17 22:00:37 +05:30
factory :on_commit_todo, class: Todo do
2017-09-10 17:25:29 +05:30
project
2017-08-17 22:00:37 +05:30
author
user
action { Todo::ASSIGNED }
2018-12-05 23:21:45 +05:30
commit_id { RepoHelpers.sample_commit.id }
2019-12-21 20:55:43 +05:30
target_type { "Commit" }
2017-08-17 22:00:37 +05:30
end
2016-04-02 18:10:28 +05:30
end