lita-github_pr_list 0.1.0 → 0.1.1

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.
@@ -2,9 +2,11 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
2
2
  let(:issue_comments_passed) { sawyer_resource_array("spec/fixtures/issue_comments_passed.json") }
3
3
  let(:issue_comments_passed_design) { sawyer_resource_array("spec/fixtures/issue_comments_passed_design.json") }
4
4
  let(:issue_comments_failed) { sawyer_resource_array("spec/fixtures/issue_comments_failed.json") }
5
- let(:issue_comments_in_review) { sawyer_resource_array("spec/fixtures/issue_comments_in_review.json") }
5
+ let(:issue_comments_in_review) { sawyer_resource_array("spec/fixtures/issue_comments_in_review_comment_hook.json") }
6
6
  let(:issue_comments_fixed) { sawyer_resource_array("spec/fixtures/issue_comments_fixed.json") }
7
+ let(:issue_comments_trivial) { sawyer_resource_array("spec/fixtures/issue_comments_trivial.json") }
7
8
  let(:issue_comments_passed_both) { sawyer_resource_array("spec/fixtures/issue_comments_passed_both.json") }
9
+
8
10
  before :each do
9
11
  Lita.config.handlers.github_pr_list.github_organization = 'aaaaaabbbbbbcccccc'
10
12
  Lita.config.handlers.github_pr_list.github_access_token = 'wafflesausages111111'
@@ -33,6 +35,15 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
33
35
  let(:issue_comment_event_failed_hankey) { File.read("spec/fixtures/issue_comment_event_failed_hankey.json") }
34
36
  let(:issue_comment_event_in_review) { File.read("spec/fixtures/issue_comment_event_in_review.json") }
35
37
  let(:issue_comment_event_fixed) { File.read("spec/fixtures/issue_comment_event_fixed.json") }
38
+ let(:issue_comment_event_no_event) { File.read("spec/fixtures/issue_comment_event_no_event.json") }
39
+
40
+ let(:issue_comment_event_passed_dev_context) { File.read("spec/fixtures/dev/issue_comment_event_passed.json") }
41
+ let(:issue_comment_event_failed_dev_context) { File.read("spec/fixtures/dev/issue_comment_event_failed.json") }
42
+ let(:issue_comment_event_in_review_dev_context) { File.read("spec/fixtures/dev/issue_comment_event_in_review.json") }
43
+
44
+ let(:issue_comment_event_passed_design_context) { File.read("spec/fixtures/design/issue_comment_event_passed.json") }
45
+ let(:issue_comment_event_failed_design_context) { File.read("spec/fixtures/design/issue_comment_event_failed.json") }
46
+ let(:issue_comment_event_in_review_design_context) { File.read("spec/fixtures/design/issue_comment_event_in_review.json") }
36
47
 
37
48
  it { is_expected.to route_http(:post, "/comment_hook").to(:comment_hook) }
38
49
 
@@ -41,6 +52,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
41
52
 
42
53
  request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed))
43
54
  response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
55
+
44
56
  github_handler = Lita::Handlers::GithubPrList.new robot
45
57
  github_handler.comment_hook(request, response)
46
58
 
@@ -57,6 +69,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
57
69
 
58
70
  github_handler = Lita::Handlers::GithubPrList.new robot
59
71
  github_handler.comment_hook(request, response)
72
+
60
73
  expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed DESIGN."\
61
74
  " https://github.com/baxterthehacker/public-repo/issues/47"\
62
75
  " - You still require DEV REVIEW")
@@ -70,6 +83,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
70
83
 
71
84
  github_handler = Lita::Handlers::GithubPrList.new robot
72
85
  github_handler.comment_hook(request, response)
86
+
73
87
  expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed."\
74
88
  " https://github.com/baxterthehacker/public-repo/issues/47")
75
89
  expect(replies.last).to_not include(" - You still require DEV REVIEW")
@@ -78,6 +92,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
78
92
 
79
93
  it "mentions the github user in the room and tell them they failed" do
80
94
  expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_failed)
95
+
81
96
  request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_failed))
82
97
  response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
83
98
 
@@ -90,6 +105,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
90
105
 
91
106
  it "mentions the github user in the room and tell them they failed for hankey too" do
92
107
  expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_failed)
108
+
93
109
  request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_failed_hankey))
94
110
  response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
95
111
 
@@ -115,6 +131,7 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
115
131
 
116
132
  it "mentions the github user in the room and tell them it has been fixed" do
117
133
  expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_fixed)
134
+
118
135
  request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_fixed))
119
136
  response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
120
137
 
@@ -124,4 +141,100 @@ describe Lita::Handlers::GithubPrList, lita_handler: true do
124
141
  expect(replies.last).to include("Spelling error in the README file has been fixed:"\
125
142
  " https://github.com/baxterthehacker/public-repo/issues/47")
126
143
  end
144
+
145
+ it "it says nothing" do
146
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_trivial)
147
+
148
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed_dev_context))
149
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
150
+
151
+ github_handler = Lita::Handlers::GithubPrList.new robot
152
+ github_handler.comment_hook(request, response)
153
+
154
+ expect(replies.last).to eq(nil)
155
+ end
156
+
157
+ context "starting out with an initial elephant" do
158
+ it "mentions the github user in the room and tell them they passed" do
159
+
160
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_passed)
161
+
162
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed_dev_context))
163
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
164
+
165
+ github_handler = Lita::Handlers::GithubPrList.new robot
166
+ github_handler.comment_hook(request, response)
167
+
168
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed DEV REVIEW."\
169
+ " https://github.com/baxterthehacker/public-repo/issues/47")
170
+ end
171
+
172
+ it "mentions the github user in the room and tell them they failed" do
173
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_failed)
174
+
175
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_failed_dev_context))
176
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
177
+
178
+ github_handler = Lita::Handlers::GithubPrList.new robot
179
+ github_handler.comment_hook(request, response)
180
+
181
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has failed."\
182
+ " https://github.com/baxterthehacker/public-repo/issues/47")
183
+ end
184
+
185
+ it "mentions the github user in the room and tell them they are reviewing" do
186
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_in_review)
187
+
188
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_in_review_dev_context))
189
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
190
+
191
+ github_handler = Lita::Handlers::GithubPrList.new robot
192
+ github_handler.comment_hook(request, response)
193
+
194
+ expect(replies.last).to include("@baxterthehacker is currently reviewing: Spelling error in the README file."\
195
+ " https://github.com/baxterthehacker/public-repo/issues/47")
196
+ end
197
+ end
198
+
199
+ context "starting out with an initial art" do
200
+ it "mentions the github user in the room and tell them they passed DESIGN" do
201
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_passed_design)
202
+
203
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_passed_design_context))
204
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
205
+
206
+ github_handler = Lita::Handlers::GithubPrList.new robot
207
+ github_handler.comment_hook(request, response)
208
+
209
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has passed DESIGN."\
210
+ " https://github.com/baxterthehacker/public-repo/issues/47")
211
+ end
212
+
213
+ it "mentions the github user in the room and tell them they failed" do
214
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_failed)
215
+
216
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_failed_design_context))
217
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
218
+
219
+ github_handler = Lita::Handlers::GithubPrList.new robot
220
+ github_handler.comment_hook(request, response)
221
+
222
+ expect(replies.last).to include("@mcwaffle1234 your pull request: Spelling error in the README file has failed."\
223
+ " https://github.com/baxterthehacker/public-repo/issues/47")
224
+ end
225
+
226
+ it "mentions the github user in the room and tell them they are reviewing" do
227
+ expect_any_instance_of(Octokit::Client).to receive(:issue_comments).and_return(issue_comments_in_review)
228
+
229
+ request = Rack::Request.new("rack.input" => StringIO.new(issue_comment_event_in_review_design_context))
230
+ response = Rack::Response.new(['Hello'], 200, { 'Content-Type' => 'text/plain' })
231
+
232
+ github_handler = Lita::Handlers::GithubPrList.new robot
233
+ github_handler.comment_hook(request, response)
234
+
235
+ expect(replies.last).to include("@baxterthehacker is currently reviewing: Spelling error in the README file."\
236
+ " https://github.com/baxterthehacker/public-repo/issues/47")
237
+ end
238
+ end
239
+
127
240
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -15,118 +15,118 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2015-11-04 00:00:00.000000000 Z
18
+ date: 2015-11-25 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: lita
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: octokit
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.0'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: bundler
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.6'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rake
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: pry
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rspec
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rspec-instafail
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: simplecov
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  description: List open pull requests for an organization.
@@ -145,10 +145,10 @@ executables:
145
145
  extensions: []
146
146
  extra_rdoc_files: []
147
147
  files:
148
- - .gitignore
149
- - .hound.yml
150
- - .rspec
151
- - .travis.yml
148
+ - ".gitignore"
149
+ - ".hound.yml"
150
+ - ".rspec"
151
+ - ".travis.yml"
152
152
  - Gemfile
153
153
  - LICENSE
154
154
  - README.md
@@ -168,6 +168,12 @@ files:
168
168
  - lib/lita/github_pr_list/web_hook.rb
169
169
  - lib/lita/handlers/github_pr_list.rb
170
170
  - lita-github_pr_list.gemspec
171
+ - spec/fixtures/design/issue_comment_event_failed.json
172
+ - spec/fixtures/design/issue_comment_event_in_review.json
173
+ - spec/fixtures/design/issue_comment_event_passed.json
174
+ - spec/fixtures/dev/issue_comment_event_failed.json
175
+ - spec/fixtures/dev/issue_comment_event_in_review.json
176
+ - spec/fixtures/dev/issue_comment_event_passed.json
171
177
  - spec/fixtures/gitlab_lookup_response.json
172
178
  - spec/fixtures/gitlab_merge_request.json
173
179
  - spec/fixtures/gitlab_remotely_closed.json
@@ -176,15 +182,18 @@ files:
176
182
  - spec/fixtures/issue_comment_event_failed_hankey.json
177
183
  - spec/fixtures/issue_comment_event_fixed.json
178
184
  - spec/fixtures/issue_comment_event_in_review.json
185
+ - spec/fixtures/issue_comment_event_no_event.json
179
186
  - spec/fixtures/issue_comment_event_passed.json
180
187
  - spec/fixtures/issue_comment_event_passed_design.json
181
188
  - spec/fixtures/issue_comments_failed.json
182
189
  - spec/fixtures/issue_comments_fixed.json
183
190
  - spec/fixtures/issue_comments_in_review.json
191
+ - spec/fixtures/issue_comments_in_review_comment_hook.json
184
192
  - spec/fixtures/issue_comments_new.json
185
193
  - spec/fixtures/issue_comments_passed.json
186
194
  - spec/fixtures/issue_comments_passed_both.json
187
195
  - spec/fixtures/issue_comments_passed_design.json
196
+ - spec/fixtures/issue_comments_trivial.json
188
197
  - spec/fixtures/one_org_issue_list.json
189
198
  - spec/fixtures/open_pull_request_response.json
190
199
  - spec/fixtures/repository_hooks.json
@@ -209,21 +218,27 @@ require_paths:
209
218
  - lib
210
219
  required_ruby_version: !ruby/object:Gem::Requirement
211
220
  requirements:
212
- - - '>='
221
+ - - ">="
213
222
  - !ruby/object:Gem::Version
214
223
  version: '0'
215
224
  required_rubygems_version: !ruby/object:Gem::Requirement
216
225
  requirements:
217
- - - '>='
226
+ - - ">="
218
227
  - !ruby/object:Gem::Version
219
228
  version: '0'
220
229
  requirements: []
221
230
  rubyforge_project:
222
- rubygems_version: 2.0.3
231
+ rubygems_version: 2.4.5
223
232
  signing_key:
224
233
  specification_version: 4
225
234
  summary: List open pull requests for an organization.
226
235
  test_files:
236
+ - spec/fixtures/design/issue_comment_event_failed.json
237
+ - spec/fixtures/design/issue_comment_event_in_review.json
238
+ - spec/fixtures/design/issue_comment_event_passed.json
239
+ - spec/fixtures/dev/issue_comment_event_failed.json
240
+ - spec/fixtures/dev/issue_comment_event_in_review.json
241
+ - spec/fixtures/dev/issue_comment_event_passed.json
227
242
  - spec/fixtures/gitlab_lookup_response.json
228
243
  - spec/fixtures/gitlab_merge_request.json
229
244
  - spec/fixtures/gitlab_remotely_closed.json
@@ -232,15 +247,18 @@ test_files:
232
247
  - spec/fixtures/issue_comment_event_failed_hankey.json
233
248
  - spec/fixtures/issue_comment_event_fixed.json
234
249
  - spec/fixtures/issue_comment_event_in_review.json
250
+ - spec/fixtures/issue_comment_event_no_event.json
235
251
  - spec/fixtures/issue_comment_event_passed.json
236
252
  - spec/fixtures/issue_comment_event_passed_design.json
237
253
  - spec/fixtures/issue_comments_failed.json
238
254
  - spec/fixtures/issue_comments_fixed.json
239
255
  - spec/fixtures/issue_comments_in_review.json
256
+ - spec/fixtures/issue_comments_in_review_comment_hook.json
240
257
  - spec/fixtures/issue_comments_new.json
241
258
  - spec/fixtures/issue_comments_passed.json
242
259
  - spec/fixtures/issue_comments_passed_both.json
243
260
  - spec/fixtures/issue_comments_passed_design.json
261
+ - spec/fixtures/issue_comments_trivial.json
244
262
  - spec/fixtures/one_org_issue_list.json
245
263
  - spec/fixtures/open_pull_request_response.json
246
264
  - spec/fixtures/repository_hooks.json