lita-github_pr_list 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lita/github_pr_list.rb +1 -2
- data/lib/lita/github_pr_list/version.rb +1 -1
- data/lib/lita/handlers/github_pr_list.rb +0 -17
- data/lita-github_pr_list.gemspec +0 -1
- data/spec/lita/handlers/comment_hook_spec.rb +2 -1
- data/spec/lita/handlers/open_pull_request_message_hook_spec.rb +2 -1
- data/spec/lita/handlers/pull_request_spec.rb +2 -2
- data/spec/lita/handlers/web_hook_spec.rb +2 -4
- data/spec/spec_helper.rb +3 -1
- metadata +25 -43
- data/CHANGELOG.md +0 -61
- data/lib/lita/github_pr_list/check_list.rb +0 -29
- data/spec/lita/handlers/check_list_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff7f8c04542f84b86ba6d3d977b21caad29a4a3a
|
4
|
+
data.tar.gz: 2c405bafbfc2b8438a23fceaa119e01eac28c1f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f002ffb1ec7aa1bacf5a81f77ec04eb4ed90fad4795caeaeab023c3a25abd0068ea7cb6a4e4903f075324aa7d9978331202cea2a1968cb32d4fdf562df8caa7e
|
7
|
+
data.tar.gz: 0f467d3c6523bbedfc9ed8127aa341bfca94448e1117ac060e76582efd220c24ac37039cc058ac2528c4f1f6debc25ca03db9c84c7e8529a416e341df9158eff
|
data/lib/lita/github_pr_list.rb
CHANGED
@@ -4,7 +4,6 @@ require "lita/github_pr_list/comment_hook"
|
|
4
4
|
require "lita/github_pr_list/pull_request"
|
5
5
|
require "lita/github_pr_list/web_hook"
|
6
6
|
require "lita/github_pr_list/alias_user"
|
7
|
-
require "lita/github_pr_list/check_list"
|
8
7
|
require "lita/github_pr_list/merge_request"
|
9
8
|
require "lita/github_pr_list/pull_request_open_message_hook"
|
10
|
-
require "lita/handlers/github_pr_list"
|
9
|
+
require "lita/handlers/github_pr_list"
|
@@ -13,8 +13,6 @@ module Lita
|
|
13
13
|
config.github_access_token = nil
|
14
14
|
config.comment_hook_url = nil
|
15
15
|
config.comment_hook_event_type = nil
|
16
|
-
config.check_list_hook_url = nil
|
17
|
-
config.check_list_event_type = nil
|
18
16
|
config.pull_request_open_message_hook_url = nil
|
19
17
|
config.pull_request_open_message_hook_event_type = nil
|
20
18
|
end
|
@@ -37,7 +35,6 @@ module Lita
|
|
37
35
|
)
|
38
36
|
|
39
37
|
http.post "/comment_hook", :comment_hook
|
40
|
-
http.post "/check_list", :check_list
|
41
38
|
http.post "/merge_request_action", :merge_request_action
|
42
39
|
http.post "/pull_request_open_message_hook", :pull_request_open_message_hook
|
43
40
|
|
@@ -61,11 +58,6 @@ module Lita
|
|
61
58
|
message_rooms(message, response)
|
62
59
|
end
|
63
60
|
|
64
|
-
def check_list(request, response)
|
65
|
-
check_list_params = { request: request, response: response, redis: redis, github_token: github_access_token }
|
66
|
-
Lita::GithubPrList::CheckList.new(check_list_params)
|
67
|
-
end
|
68
|
-
|
69
61
|
def pull_request_open_message_hook(request, response)
|
70
62
|
message = Lita::GithubPrList::PullRequestOpenMessageHook.new({ request: request, response: response, redis: redis }).message
|
71
63
|
message_rooms(message, response)
|
@@ -119,7 +111,6 @@ module Lita
|
|
119
111
|
|
120
112
|
def hook_info
|
121
113
|
{ comment_hook: { hook_url: comment_hook_url, event_type: comment_hook_event_type },
|
122
|
-
check_list_hook: { hook_url: check_list_hook_url, event_type: check_list_event_type },
|
123
114
|
pull_request_open_message_hook: { hook_url: pull_request_open_message_hook_url, event_type: pull_request_open_message_hook_event_type } }
|
124
115
|
end
|
125
116
|
|
@@ -138,14 +129,6 @@ module Lita
|
|
138
129
|
def pull_request_open_message_hook_event_type
|
139
130
|
Lita.config.handlers.github_pr_list.pull_request_open_message_hook_event_type
|
140
131
|
end
|
141
|
-
|
142
|
-
def check_list_hook_url
|
143
|
-
Lita.config.handlers.github_pr_list.check_list_hook_url
|
144
|
-
end
|
145
|
-
|
146
|
-
def check_list_event_type
|
147
|
-
Lita.config.handlers.github_pr_list.check_list_event_type
|
148
|
-
end
|
149
132
|
end
|
150
133
|
|
151
134
|
Lita.register_handler(GithubPrList)
|
data/lita-github_pr_list.gemspec
CHANGED
@@ -2,6 +2,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
2
2
|
before :each do
|
3
3
|
Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
|
4
4
|
Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
|
5
|
+
allow_any_instance_of(Lita::Configuration).to receive(:hipchat).and_return(OpenStruct.new({ rooms: ["room"] }))
|
5
6
|
end
|
6
7
|
|
7
8
|
let(:issue_comment_event_passed) { File.read("spec/fixtures/issue_comment_event_passed.json") }
|
@@ -10,7 +11,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
10
11
|
let(:issue_comment_event_in_review) { File.read("spec/fixtures/issue_comment_event_in_review.json") }
|
11
12
|
let(:issue_comment_event_fixed) { File.read("spec/fixtures/issue_comment_event_fixed.json") }
|
12
13
|
|
13
|
-
it {
|
14
|
+
it { is_expected.to route_http(:post, "/comment_hook").to(:comment_hook) }
|
14
15
|
|
15
16
|
it "mentions the github user in the room and tell them they passed" do
|
16
17
|
request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed))
|
@@ -2,11 +2,12 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
2
2
|
before :each do
|
3
3
|
Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
|
4
4
|
Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
|
5
|
+
allow_any_instance_of(Lita::Configuration).to receive(:hipchat).and_return(OpenStruct.new({ rooms: ["room"] }))
|
5
6
|
end
|
6
7
|
|
7
8
|
let(:open_pull_request_response) { [File.read("spec/fixtures/open_pull_request_response.json")] }
|
8
9
|
|
9
|
-
it {
|
10
|
+
it { is_expected.to route_http(:post, "/pull_request_open_message_hook").to(:pull_request_open_message_hook) }
|
10
11
|
|
11
12
|
it "sends a message to hipchat - pull request opened" do
|
12
13
|
request = Rack::Request.new("rack.input" => StringIO.new(open_pull_request_response.first))
|
@@ -32,8 +32,8 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
32
32
|
let(:gitlab_merge_request) { OpenStruct.new(body: OpenStruct.new(read: File.read("spec/fixtures/gitlab_merge_request.json"))) }
|
33
33
|
let(:gitlab_request_closed) { OpenStruct.new(body: OpenStruct.new(read: File.read("spec/fixtures/gitlab_request_closed.json"))) }
|
34
34
|
|
35
|
-
it {
|
36
|
-
it {
|
35
|
+
it { is_expected.to route_command("pr list").to(:list_org_pr) }
|
36
|
+
it { is_expected.to route_http(:post, "/merge_request_action").to(:merge_request_action) }
|
37
37
|
|
38
38
|
it "displays a list of pull requests" do
|
39
39
|
expect_any_instance_of(Octokit::Client).to receive(:org_issues).and_return(two_issues)
|
@@ -6,8 +6,6 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
6
6
|
Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
|
7
7
|
Lita.config.handlers.github_pr_list.comment_hook_url = 'https://example.com/hook'
|
8
8
|
Lita.config.handlers.github_pr_list.comment_hook_event_type = 'comment_event_type'
|
9
|
-
Lita.config.handlers.github_pr_list.check_list_hook_url = 'https://example.com/hook'
|
10
|
-
Lita.config.handlers.github_pr_list.check_list_event_type = 'check_list_event_type'
|
11
9
|
Lita.config.handlers.github_pr_list.pull_request_open_message_hook_url = 'https://example.com/hook'
|
12
10
|
Lita.config.handlers.github_pr_list.pull_request_open_message_hook_event_type = 'pull_request_open_message_event_type'
|
13
11
|
end
|
@@ -31,8 +29,8 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
|
|
31
29
|
let(:repos) { sawyer_resource_array("spec/fixtures/repository_list.json") }
|
32
30
|
let(:hooks) { sawyer_resource_array("spec/fixtures/repository_hooks.json") }
|
33
31
|
|
34
|
-
it {
|
35
|
-
it {
|
32
|
+
it { is_expected.to route_command("pr add hooks").to(:add_pr_hooks) }
|
33
|
+
it { is_expected.to route_command("pr remove hooks").to(:remove_pr_hooks) }
|
36
34
|
|
37
35
|
it "adds web hooks to an org's repos" do
|
38
36
|
allow_any_instance_of(Octokit::Client).to receive(:organization_repositories).and_return(repos)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-github_pr_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -13,132 +13,118 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2015-
|
16
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: lita
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
|
-
- -
|
22
|
+
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: '0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
|
-
- -
|
29
|
+
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: '0'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: octokit
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
|
-
- - ~>
|
36
|
+
- - "~>"
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '3.0'
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- - ~>
|
43
|
+
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '3.0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: bundler
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
|
-
- - ~>
|
50
|
+
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '1.6'
|
53
53
|
type: :development
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - ~>
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '1.6'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rake
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ">="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: pry
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
type: :development
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: rspec
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
type: :development
|
96
96
|
prerelease: false
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rspec-instafail
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
|
-
- -
|
106
|
+
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
type: :development
|
110
110
|
prerelease: false
|
111
111
|
version_requirements: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
name: simplecov
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
type: :development
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- -
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '0'
|
130
|
-
- !ruby/object:Gem::Dependency
|
131
|
-
name: pimpmychangelog
|
132
|
-
requirement: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - '>='
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '0'
|
137
|
-
type: :development
|
138
|
-
prerelease: false
|
139
|
-
version_requirements: !ruby/object:Gem::Requirement
|
140
|
-
requirements:
|
141
|
-
- - '>='
|
127
|
+
- - ">="
|
142
128
|
- !ruby/object:Gem::Version
|
143
129
|
version: '0'
|
144
130
|
description: List open pull requests for an organization.
|
@@ -155,11 +141,10 @@ executables:
|
|
155
141
|
extensions: []
|
156
142
|
extra_rdoc_files: []
|
157
143
|
files:
|
158
|
-
- .gitignore
|
159
|
-
- .hound.yml
|
160
|
-
- .rspec
|
161
|
-
- .travis.yml
|
162
|
-
- CHANGELOG.md
|
144
|
+
- ".gitignore"
|
145
|
+
- ".hound.yml"
|
146
|
+
- ".rspec"
|
147
|
+
- ".travis.yml"
|
163
148
|
- Gemfile
|
164
149
|
- LICENSE
|
165
150
|
- README.md
|
@@ -169,7 +154,6 @@ files:
|
|
169
154
|
- lib/lita/builders/merge_request_builder.rb
|
170
155
|
- lib/lita/github_pr_list.rb
|
171
156
|
- lib/lita/github_pr_list/alias_user.rb
|
172
|
-
- lib/lita/github_pr_list/check_list.rb
|
173
157
|
- lib/lita/github_pr_list/comment_hook.rb
|
174
158
|
- lib/lita/github_pr_list/gitlab_merge_requests.rb
|
175
159
|
- lib/lita/github_pr_list/merge_request.rb
|
@@ -201,7 +185,6 @@ files:
|
|
201
185
|
- spec/fixtures/two_org_issue_list.json
|
202
186
|
- spec/fixtures/update_pull_request_response.json
|
203
187
|
- spec/lita/handlers/alias_spec.rb
|
204
|
-
- spec/lita/handlers/check_list_spec.rb
|
205
188
|
- spec/lita/handlers/comment_hook_spec.rb
|
206
189
|
- spec/lita/handlers/open_pull_request_message_hook_spec.rb
|
207
190
|
- spec/lita/handlers/pull_request_spec.rb
|
@@ -218,17 +201,17 @@ require_paths:
|
|
218
201
|
- lib
|
219
202
|
required_ruby_version: !ruby/object:Gem::Requirement
|
220
203
|
requirements:
|
221
|
-
- -
|
204
|
+
- - ">="
|
222
205
|
- !ruby/object:Gem::Version
|
223
206
|
version: '0'
|
224
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
208
|
requirements:
|
226
|
-
- -
|
209
|
+
- - ">="
|
227
210
|
- !ruby/object:Gem::Version
|
228
211
|
version: '0'
|
229
212
|
requirements: []
|
230
213
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.0
|
214
|
+
rubygems_version: 2.2.0
|
232
215
|
signing_key:
|
233
216
|
specification_version: 4
|
234
217
|
summary: List open pull requests for an organization.
|
@@ -254,7 +237,6 @@ test_files:
|
|
254
237
|
- spec/fixtures/two_org_issue_list.json
|
255
238
|
- spec/fixtures/update_pull_request_response.json
|
256
239
|
- spec/lita/handlers/alias_spec.rb
|
257
|
-
- spec/lita/handlers/check_list_spec.rb
|
258
240
|
- spec/lita/handlers/comment_hook_spec.rb
|
259
241
|
- spec/lita/handlers/open_pull_request_message_hook_spec.rb
|
260
242
|
- spec/lita/handlers/pull_request_spec.rb
|
data/CHANGELOG.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
## 2015-04-28
|
2
|
-
|
3
|
-
Bug Fixes:
|
4
|
-
|
5
|
-
* Updating syntax on Lita.adapters to match Lita 5 syntax (now used in main Lita app). ([#38][], [@darkodosenovic][])
|
6
|
-
|
7
|
-
## 2015-04-15
|
8
|
-
|
9
|
-
Bug Fixes:
|
10
|
-
|
11
|
-
* Incrementing gem version, as rubygems doesn't let you push old versions. ([#37][], [@MathieuGilbert][])
|
12
|
-
|
13
|
-
## 2015-04-14
|
14
|
-
|
15
|
-
Bug Fixes:
|
16
|
-
|
17
|
-
* Updating syntax on Lita.adapters to match Lita 5 syntax (now used in main Lita app). ([#35][], [@MathieuGilbert][])
|
18
|
-
|
19
|
-
## 2015-04-10
|
20
|
-
|
21
|
-
Features:
|
22
|
-
|
23
|
-
* Querying Gitlab's API for a list of merge requests when "pr list" command is made, to clear out the merge events we didn't get a webhook call for. ([#33][], [@MathieuGilbert][])
|
24
|
-
|
25
|
-
## 2014-11-04
|
26
|
-
|
27
|
-
Bug Fixes:
|
28
|
-
|
29
|
-
* Adding notification sent to Hipchat, opened status only. ([#32][], [@darkodosenovic][])
|
30
|
-
|
31
|
-
|
32
|
-
## 2014-10-09
|
33
|
-
|
34
|
-
Bug Fixes:
|
35
|
-
|
36
|
-
* Hipchat doesn't recognize (hankey), reverting to (poop). ([#30][], [@MathieuGilbert][])
|
37
|
-
|
38
|
-
## 2014-10-07
|
39
|
-
|
40
|
-
Features:
|
41
|
-
|
42
|
-
* :hankey: now accepted along with :poop: ([#29][], [@MathieuGilbert][])
|
43
|
-
|
44
|
-
## 2014-09-22
|
45
|
-
|
46
|
-
Features:
|
47
|
-
|
48
|
-
- Remove merge into master and deploy to production items from check list. ([@rubene][], [#28][])
|
49
|
-
|
50
|
-
<!--- The following link definition list is generated by PimpMyChangelog --->
|
51
|
-
[#28]: https://github.com/amaabca/lita-github_pr_list/issues/28
|
52
|
-
[#29]: https://github.com/amaabca/lita-github_pr_list/issues/29
|
53
|
-
[#30]: https://github.com/amaabca/lita-github_pr_list/issues/30
|
54
|
-
[#32]: https://github.com/amaabca/lita-github_pr_list/issues/32
|
55
|
-
[#33]: https://github.com/amaabca/lita-github_pr_list/issues/33
|
56
|
-
[#35]: https://github.com/amaabca/lita-github_pr_list/issues/35
|
57
|
-
[#37]: https://github.com/amaabca/lita-github_pr_list/issues/37
|
58
|
-
[#38]: https://github.com/amaabca/lita-github_pr_list/issues/38
|
59
|
-
[@MathieuGilbert]: https://github.com/MathieuGilbert
|
60
|
-
[@darkodosenovic]: https://github.com/darkodosenovic
|
61
|
-
[@rubene]: https://github.com/rubene
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Lita
|
2
|
-
module GithubPrList
|
3
|
-
class CheckList
|
4
|
-
attr_accessor :request, :response, :payload, :redis, :repo_name, :comment_body,
|
5
|
-
:title, :id, :github_token, :github_client, :list
|
6
|
-
|
7
|
-
def initialize(params = {})
|
8
|
-
self.github_token = params.fetch(:github_token, nil)
|
9
|
-
self.response = params.fetch(:response, nil)
|
10
|
-
self.request = params.fetch(:request, nil)
|
11
|
-
self.redis = params.fetch(:redis, nil)
|
12
|
-
self.list = params.fetch(:list, "\n- [ ] Change log\n- [ ] Demo page\n- [ ] Product owner signoff\n")
|
13
|
-
|
14
|
-
raise "invalid params in #{self.class.name}" if response.nil? || request.nil? || redis.nil?
|
15
|
-
|
16
|
-
self.github_client = Octokit::Client.new(access_token: github_token, auto_paginate: true)
|
17
|
-
|
18
|
-
self.payload = JSON.parse(request.body.read)
|
19
|
-
self.repo_name = payload["pull_request"]["head"]["repo"]["full_name"]
|
20
|
-
self.comment_body = "#{payload["pull_request"]["body"]} #{list}"
|
21
|
-
self.title = payload["pull_request"]["title"]
|
22
|
-
self.id = payload["number"]
|
23
|
-
|
24
|
-
options = { title: title, body: comment_body, state: 'open' }
|
25
|
-
github_client.update_pull_request(repo_name, id, options) if payload["action"] == "opened"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
describe Lita::Handlers::GithubPrList, lita_handler: true do
|
2
|
-
before :each do
|
3
|
-
Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
|
4
|
-
Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
|
5
|
-
end
|
6
|
-
|
7
|
-
let(:update_pull_request_response) { File.read("spec/fixtures/update_pull_request_response.json") }
|
8
|
-
let(:open_pull_request_response) { [File.read("spec/fixtures/open_pull_request_response.json")] }
|
9
|
-
let(:check_list) do
|
10
|
-
"- [ ] Change log - [ ] Demo page - [ ] Product owner signoff - [ ] Merge into master - [ ] Deploy to production"
|
11
|
-
end
|
12
|
-
|
13
|
-
it { routes_http(:post, "/check_list").to(:check_list) }
|
14
|
-
|
15
|
-
it "adds the check list to the body of the pull request" do
|
16
|
-
allow_any_instance_of(Octokit::Client).to receive(:update_pull_request).and_return(update_pull_request_response)
|
17
|
-
request = Rack::Request.new("rack.input" => StringIO.new(open_pull_request_response.first))
|
18
|
-
response = Rack::Response.new(['Hello'], 200, {'Content-Type' => 'text/plain'})
|
19
|
-
github_handler = Lita::Handlers::GithubPrList.new
|
20
|
-
github_handler.check_list(request, response)
|
21
|
-
expect(update_pull_request_response).to include(check_list)
|
22
|
-
end
|
23
|
-
end
|