2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
FactoryBot.define do
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :event do
|
2017-09-10 17:25:29 +05:30
|
|
|
project
|
2018-03-17 18:26:18 +05:30
|
|
|
author(factory: :user) { project.creator }
|
2019-12-21 20:55:43 +05:30
|
|
|
action { Event::JOINED }
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
trait(:created) { action { Event::CREATED } }
|
|
|
|
trait(:updated) { action { Event::UPDATED } }
|
|
|
|
trait(:closed) { action { Event::CLOSED } }
|
|
|
|
trait(:reopened) { action { Event::REOPENED } }
|
|
|
|
trait(:pushed) { action { Event::PUSHED } }
|
|
|
|
trait(:commented) { action { Event::COMMENTED } }
|
|
|
|
trait(:merged) { action { Event::MERGED } }
|
|
|
|
trait(:joined) { action { Event::JOINED } }
|
|
|
|
trait(:left) { action { Event::LEFT } }
|
|
|
|
trait(:destroyed) { action { Event::DESTROYED } }
|
|
|
|
trait(:expired) { action { Event::EXPIRED } }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
factory :closed_issue_event do
|
|
|
|
action { Event::CLOSED }
|
|
|
|
target factory: :closed_issue
|
|
|
|
end
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
factory :wiki_page_event do
|
|
|
|
action { Event::CREATED }
|
|
|
|
project { @overrides[:wiki_page]&.project || create(:project, :wiki_repo) }
|
|
|
|
target { create(:wiki_page_meta, :for_wiki_page, wiki_page: wiki_page) }
|
|
|
|
|
|
|
|
transient do
|
|
|
|
wiki_page { create(:wiki_page, project: project) }
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :push_event, class: 'PushEvent' do
|
2017-09-10 17:25:29 +05:30
|
|
|
project factory: :project_empty_repo
|
2018-12-05 23:21:45 +05:30
|
|
|
author(factory: :user) { project.creator }
|
2019-12-21 20:55:43 +05:30
|
|
|
action { Event::PUSHED }
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
factory :push_event_payload do
|
|
|
|
event
|
2019-12-21 20:55:43 +05:30
|
|
|
commit_count { 1 }
|
|
|
|
action { :pushed }
|
|
|
|
ref_type { :branch }
|
|
|
|
ref { 'master' }
|
|
|
|
commit_to { '3cdce97ed87c91368561584e7358f4d46e3e173c' }
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|