blob: 944e0fdde2dcdfca856d3cb7c8b8d973823b1894 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
module Gitlab
module Ci
module Status
class Factory
def initialize(subject, user = nil)
@subject = subject
@user = user
end
def fabricate!
if extended_status
extended_status.new(core_status)
else
core_status
end
end
def self.extended_statuses
[]
end
def self.common_helpers
Module.new
end
private
def simple_status
@simple_status ||= @subject.status || :created
end
def core_status
Gitlab::Ci::Status
.const_get(simple_status.capitalize)
.new(@subject)
.extend(self.class.common_helpers)
end
def extended_status
@extended ||= self.class.extended_statuses.find do |status|
status.matches?(@subject, @user)
end
end
end
end
end
end
|