mock_issue_tracker.rb
929 Bytes
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
48
49
50
51
52
53
54
module ErrbitPlugin
class MockIssueTracker < IssueTracker
def self.label
'mock'
end
def self.note
'A fake issue tracker to help in testing purpose'
end
def self.fields
{
foo: { label: 'foo' },
bar: { label: 'bar' }
}
end
attr_accessor :output
def initialize(*)
super
@output = []
end
def configured?
!errors.any?
end
def errors
errors = []
errors << [:base, 'foo is required'] unless options[:foo]
errors << [:base, 'bar is required'] unless options[:bar]
errors
end
def create_issue(title, body, user)
@output << [title, body, user]
"http://example.com/mock-errbit"
end
def close_issue(url, user)
@output << [url, user]
"http://example.com/mock-errbit"
end
def url
''
end
def comments_allowed?
false
end
end
end