lita-jira 0.8.1 → 0.9.0
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/.rubocop.yml +11 -0
- data/.ruby-version +1 -0
- data/.travis.yml +4 -2
- data/CHANGELOG.md +14 -1
- data/Gemfile +2 -2
- data/README.md +0 -1
- data/Rakefile +3 -1
- data/lib/jirahelper/issue.rb +11 -6
- data/lib/jirahelper/misc.rb +2 -0
- data/lib/jirahelper/regex.rb +4 -2
- data/lib/jirahelper/utility.rb +2 -0
- data/lib/lita-jira.rb +3 -1
- data/lib/lita/handlers/jira.rb +23 -5
- data/lib/lita/handlers/jira_utility.rb +2 -0
- data/lita-jira.gemspec +7 -5
- data/spec/jirahelper/regex_spec.rb +26 -0
- data/spec/lita/handlers/jira_spec.rb +108 -68
- data/spec/lita/handlers/jira_utility_spec.rb +2 -0
- data/spec/spec_helper.rb +17 -6
- metadata +18 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea9ffc666b62d8002d7b6a73c06326729d9ea353
|
4
|
+
data.tar.gz: 32f4b00c25016a0647b1ef10a36c1010a6889933
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed36ac8d4af1cf4517d6a9c275d1110a8a38bccfd8ae5fb12a8aa35665cc377437b83dea732ebbe90db353a6b713b778742c5ec31ad357c9b81c496ded8f90bc
|
7
|
+
data.tar.gz: 6941736d8aefcbd0ea8ef7a4d8927089c03f99f9834ecf4efdeaf0433b4f9c77af52624b93e76f1aaf6dad0614638c86566d5029ee3000857fe0a4ca029ede8b
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,17 @@
|
|
1
|
+
# TODO: Enable
|
2
|
+
# require: rubocop-rspec
|
3
|
+
|
1
4
|
FileName:
|
2
5
|
Exclude:
|
3
6
|
- lib/lita-jira.rb
|
4
7
|
|
5
8
|
LineLength:
|
6
9
|
Max: 190
|
10
|
+
|
11
|
+
Metrics/BlockLength:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/**/*'
|
14
|
+
|
15
|
+
Style/FrozenStringLiteralComment:
|
16
|
+
Exclude:
|
17
|
+
- spec/lita/handlers/jira_spec.rb
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,12 +5,25 @@ This project adheres to [Semantic Versioning] and [Keep A Changelog].
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.9.0] - 2017-11-27
|
9
|
+
### Improvements
|
10
|
+
- [#21] Provide additional information in error logging
|
11
|
+
- [#24] Search multiple issue keys in single message in ambient route
|
12
|
+
- Update testing to currently supported Ruby versions
|
13
|
+
|
14
|
+
### Fixes:
|
15
|
+
- [#22] Fix TODO regex to capture all information
|
16
|
+
|
8
17
|
## [0.7.2] - 2015-12-01
|
9
18
|
### Fixed
|
10
19
|
- Updated Simplecov invocation to newer style
|
11
20
|
- Adjusted ambient issue detection to avoid triggering on URL-like strings
|
12
21
|
|
13
|
-
[
|
22
|
+
[#24]: https://github.com/esigler/lita-jira/pull/24
|
23
|
+
[#22]: https://github.com/esigler/lita-jira/pull/22
|
24
|
+
[#21]: https://github.com/esigler/lita-jira/pull/21
|
25
|
+
[Unreleased]: https://github.com/esigler/lita-jira/compare/v0.9.0...HEAD
|
26
|
+
[0.9.0]: https://github.com/esigler/lita-jira/compare/v0.8.1...v0.9.0
|
14
27
|
[0.7.2]: https://github.com/esigler/lita-jira/compare/v0.7.1...v0.7.2
|
15
28
|
[Semantic Versioning]: http://semver.org/
|
16
29
|
[Keep A Changelog]: http://keepachangelog.com/
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
[](https://travis-ci.org/esigler/lita-jira)
|
4
4
|
[](https://tldrlegal.com/license/mit-license)
|
5
5
|
[](https://rubygems.org/gems/lita-jira)
|
6
|
-
[](https://coveralls.io/r/esigler/lita-jira)
|
7
6
|
[](https://codeclimate.com/github/esigler/lita-jira)
|
8
7
|
[](https://gemnasium.com/esigler/lita-jira)
|
9
8
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rspec/core/rake_task'
|
3
5
|
require 'rubocop/rake_task'
|
@@ -5,4 +7,4 @@ require 'rubocop/rake_task'
|
|
5
7
|
RSpec::Core::RakeTask.new(:spec)
|
6
8
|
RuboCop::RakeTask.new(:rubocop)
|
7
9
|
|
8
|
-
task default: [
|
10
|
+
task default: %i[spec rubocop]
|
data/lib/jirahelper/issue.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Helper functions for lita-jira
|
2
4
|
module JiraHelper
|
3
5
|
# Issues
|
4
6
|
module Issue
|
5
7
|
def fetch_issue(key, expected = true)
|
6
8
|
client.Issue.find(key)
|
7
|
-
rescue
|
8
|
-
log.error(
|
9
|
+
rescue StandardError => e
|
10
|
+
log.error("JIRA HTTPError #{e}") if expected
|
9
11
|
nil
|
10
12
|
end
|
11
13
|
|
@@ -13,14 +15,17 @@ module JiraHelper
|
|
13
15
|
#
|
14
16
|
# @param [Type String] jql Valid JQL query
|
15
17
|
# @return [Type Array] 0-m JIRA Issues returned from query
|
16
|
-
def fetch_issues(jql)
|
18
|
+
def fetch_issues(jql, suppress_exceptions = false)
|
17
19
|
client.Issue.jql(jql)
|
20
|
+
rescue StandardError => e
|
21
|
+
throw e unless suppress_exceptions
|
22
|
+
nil
|
18
23
|
end
|
19
24
|
|
20
25
|
def fetch_project(key)
|
21
26
|
client.Project.find(key)
|
22
|
-
rescue
|
23
|
-
log.error(
|
27
|
+
rescue StandardError => e
|
28
|
+
log.error("JIRA HTTPError #{e}")
|
24
29
|
nil
|
25
30
|
end
|
26
31
|
|
@@ -70,7 +75,7 @@ module JiraHelper
|
|
70
75
|
# @return [Type String] fallback or returned value from yield block
|
71
76
|
def optional_issue_property(fallback = '')
|
72
77
|
yield
|
73
|
-
rescue
|
78
|
+
rescue StandardError
|
74
79
|
fallback
|
75
80
|
end
|
76
81
|
end
|
data/lib/jirahelper/misc.rb
CHANGED
data/lib/jirahelper/regex.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Helper functions for lita-jira
|
2
4
|
module JiraHelper
|
3
5
|
# Regular expressions
|
4
6
|
module Regex
|
5
7
|
COMMENT_PATTERN = /\"(?<comment>.+)\"/
|
6
|
-
SUBJECT_PATTERN = /\"(?<subject
|
7
|
-
SUMMARY_PATTERN = /\"(?<summary
|
8
|
+
SUBJECT_PATTERN = /\"(?<subject>.+?)\"/
|
9
|
+
SUMMARY_PATTERN = /\"(?<summary>.+?)\"/
|
8
10
|
PROJECT_PATTERN = /(?<project>[a-zA-Z0-9]{1,10})/
|
9
11
|
ISSUE_PATTERN = /(?<issue>#{PROJECT_PATTERN}-[0-9]{1,5}+)/
|
10
12
|
EMAIL_PATTERN = /(?<email>[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+)/i
|
data/lib/jirahelper/utility.rb
CHANGED
data/lib/lita-jira.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'lita'
|
2
4
|
|
3
5
|
Lita.load_locales Dir[File.expand_path(
|
4
6
|
File.join('..', '..', 'locales', '*.yml'), __FILE__
|
5
7
|
)]
|
6
8
|
|
7
|
-
require 'jira'
|
9
|
+
require 'jira-ruby'
|
8
10
|
|
9
11
|
require 'jirahelper/issue'
|
10
12
|
require 'jirahelper/misc'
|
data/lib/lita/handlers/jira.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# lita-jira plugin
|
2
4
|
module Lita
|
3
5
|
# Because we can.
|
@@ -121,8 +123,8 @@ module Lita
|
|
121
123
|
|
122
124
|
begin
|
123
125
|
issues = fetch_issues("assignee = '#{get_email(response.user)}' AND status not in (Closed)")
|
124
|
-
rescue
|
125
|
-
log.error(
|
126
|
+
rescue StandardError => e
|
127
|
+
log.error("JIRA HTTPError #{e}")
|
126
128
|
response.reply(t('error.request'))
|
127
129
|
return
|
128
130
|
end
|
@@ -134,8 +136,24 @@ module Lita
|
|
134
136
|
|
135
137
|
def ambient(response)
|
136
138
|
return if invalid_ambient?(response)
|
137
|
-
|
138
|
-
response.
|
139
|
+
|
140
|
+
# response.matches returns an array of array of strings, where the inner arrays are [issue, project]
|
141
|
+
# (e.g. [["XYZ-123", "XYZ"]]). We map it into an array of issues (["XYZ-123"]).
|
142
|
+
issue_keys = response.matches.map { |match| match[0] }
|
143
|
+
|
144
|
+
if issue_keys.length > 1
|
145
|
+
# Note that if any of the issue keys do not exist in JIRA, then an exception is thrown and no results are returned.
|
146
|
+
# A JIRA 'suggestion' has been filed to allow partial results: https://jira.atlassian.com/browse/JRASERVER-40245
|
147
|
+
jql = "key in (#{issue_keys.join(',')})"
|
148
|
+
# Exceptions are suppressed and no results are returned since this is just ambient parsing and we do not want
|
149
|
+
# the bot to pop up with error messages when an explicit command was not requested.
|
150
|
+
issues = fetch_issues(jql, true)
|
151
|
+
response.reply(format_issues(issues)) if issues && !issues.empty?
|
152
|
+
else
|
153
|
+
# Only one issue key was parsed, so directly fetch the one issue.
|
154
|
+
issue = fetch_issue(response.match_data['issue'], false)
|
155
|
+
response.reply(format_issue(issue)) if issue
|
156
|
+
end
|
139
157
|
end
|
140
158
|
|
141
159
|
private
|
@@ -152,7 +170,7 @@ module Lita
|
|
152
170
|
points = response.match_data['points']
|
153
171
|
begin
|
154
172
|
issue.save!(fields: { config.points_field.to_sym => points.to_i })
|
155
|
-
rescue
|
173
|
+
rescue StandardError
|
156
174
|
return response.reply(t('error.unable_to_point'))
|
157
175
|
end
|
158
176
|
response.reply(t('point.added', issue: issue.key, points: points))
|
data/lita-jira.gemspec
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
Gem::Specification.new do |spec|
|
2
4
|
spec.name = 'lita-jira'
|
3
|
-
spec.version = '0.
|
4
|
-
spec.authors = ['Eric Sigler', 'Matt Critchlow', 'Tristan Chong', 'Lee Briggs']
|
5
|
-
spec.email = ['me@esigler.com', 'matt.critchlow@gmail.com', 'ong@tristaneuan.ch', 'lee@brig.gs']
|
5
|
+
spec.version = '0.9.0'
|
6
|
+
spec.authors = ['Eric Sigler', 'Matt Critchlow', 'Tristan Chong', 'Lee Briggs', 'Kenneth Kwan']
|
7
|
+
spec.email = ['me@esigler.com', 'matt.critchlow@gmail.com', 'ong@tristaneuan.ch', 'lee@brig.gs', 'kenneth.m.kwan@gmail.com']
|
6
8
|
spec.description = 'A JIRA plugin for Lita.'
|
7
9
|
spec.summary = spec.description
|
8
10
|
spec.homepage = 'https://github.com/esigler/lita-jira'
|
@@ -14,13 +16,13 @@ Gem::Specification.new do |spec|
|
|
14
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
17
|
spec.require_paths = ['lib']
|
16
18
|
|
17
|
-
spec.add_runtime_dependency 'lita', '>= 4.0'
|
18
19
|
spec.add_runtime_dependency 'jira-ruby'
|
20
|
+
spec.add_runtime_dependency 'lita', '>= 4.0'
|
19
21
|
|
20
22
|
spec.add_development_dependency 'bundler'
|
21
|
-
spec.add_development_dependency 'coveralls'
|
22
23
|
spec.add_development_dependency 'rake'
|
23
24
|
spec.add_development_dependency 'rspec'
|
24
25
|
spec.add_development_dependency 'rubocop'
|
26
|
+
spec.add_development_dependency 'rubocop-rspec'
|
25
27
|
spec.add_development_dependency 'simplecov'
|
26
28
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe JiraHelper::Regex do
|
6
|
+
PROJECT_PATTERN = JiraHelper::Regex::PROJECT_PATTERN
|
7
|
+
SUBJECT_PATTERN = JiraHelper::Regex::SUBJECT_PATTERN
|
8
|
+
SUMMARY_PATTERN = JiraHelper::Regex::SUMMARY_PATTERN
|
9
|
+
|
10
|
+
#
|
11
|
+
# route(
|
12
|
+
# /^todo\s#{PROJECT_PATTERN}\s#{SUBJECT_PATTERN}(\s#{SUMMARY_PATTERN})?$/,
|
13
|
+
#
|
14
|
+
let(:regex) { Regexp.new(/^todo\s#{PROJECT_PATTERN}\s#{SUBJECT_PATTERN}(\s#{SUMMARY_PATTERN})?$/) }
|
15
|
+
|
16
|
+
it 'double quotes around subject and summary' do
|
17
|
+
subject = 'Any subject'
|
18
|
+
summary = 'Any summary'
|
19
|
+
project = 'PRJ'
|
20
|
+
message = %(todo #{project} "#{subject}" "#{summary}")
|
21
|
+
match = message.match(regex)
|
22
|
+
expect(match['project']).to eq(project)
|
23
|
+
expect(match['summary']).to eq(summary)
|
24
|
+
expect(match['subject']).to eq(subject)
|
25
|
+
end
|
26
|
+
end
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Lita::Handlers::Jira, lita_handler: true do
|
4
4
|
before do
|
5
|
+
registry.register_handler(Lita::Handlers::Jira)
|
6
|
+
registry.register_handler(Lita::Handlers::JiraUtility)
|
5
7
|
registry.config.handlers.jira.site = 'http://jira.local'
|
6
8
|
end
|
7
9
|
|
@@ -207,6 +209,12 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
207
209
|
expect(replies.last).to eq('Issue XYZ-987 created')
|
208
210
|
end
|
209
211
|
|
212
|
+
it 'creates a new issue if the project is valid and there is a summary and subject' do
|
213
|
+
grab_request(valid_client)
|
214
|
+
send_command('todo XYZ "Some subject text" "Summary text"')
|
215
|
+
expect(replies.last).to eq('Issue XYZ-987 created')
|
216
|
+
end
|
217
|
+
|
210
218
|
it 'warns the user when the project is not valid' do
|
211
219
|
grab_request(failed_find_project)
|
212
220
|
send_command('todo ABC "Some summary text"')
|
@@ -215,84 +223,116 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
215
223
|
end
|
216
224
|
|
217
225
|
describe '#ambient' do
|
218
|
-
|
226
|
+
before do
|
227
|
+
registry.config.handlers.jira.ambient = true
|
228
|
+
@user1 = Lita::User.create('U1', name: 'User 1', mention_name: 'user1')
|
229
|
+
@user2 = Lita::User.create('U2', name: 'User 2', mention_name: 'user2')
|
230
|
+
@user3 = Lita::User.create('U3', name: 'User 3', mention_name: 'user3')
|
231
|
+
@user4 = Lita::User.create('U4', name: 'User 4', mention_name: 'user4')
|
232
|
+
registry.config.handlers.jira.ignore = ['User 2', 'U3', 'user4']
|
219
233
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
234
|
+
grab_request(valid_client)
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'does not show details for a detected issue by default' do
|
238
|
+
registry.config.handlers.jira.ambient = false
|
239
|
+
send_message('foo XYZ-987 bar')
|
240
|
+
expect(replies).to eq([])
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'shows details for a detected issue in a message' do
|
244
|
+
send_message('XYZ-987')
|
245
|
+
send_message('foo XYZ-987 bar')
|
246
|
+
send_message('foo XYZ-987?')
|
247
|
+
expect(replies.size).to eq(3)
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'does not show details for a detected issue in a command' do
|
251
|
+
send_command('foo XYZ-987 bar')
|
252
|
+
expect(replies.size).to eq(0)
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'does not show details for a issue in a URL-ish context' do
|
256
|
+
send_message('http://www.example.com/XYZ-987')
|
257
|
+
send_message('http://www.example.com/XYZ-987.html')
|
258
|
+
send_message('http://www.example.com/someother-XYZ-987.html')
|
259
|
+
send_message('TIL http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-each_slice')
|
260
|
+
expect(replies.size).to eq(0)
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'shows details for a detected issue sent by a user absent from the list' do
|
264
|
+
send_message('foo XYZ-987 bar', as: @user1)
|
265
|
+
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
266
|
+
end
|
225
267
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
268
|
+
it 'does not show details for a detected issue sent by a user whose name is on the list' do
|
269
|
+
send_message('foo XYZ-987 bar', as: @user2)
|
270
|
+
expect(replies.size).to eq(0)
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'does not show details for a detected issue sent by a user whose ID is on the list' do
|
274
|
+
send_message('foo XYZ-987 bar', as: @user3)
|
275
|
+
expect(replies.size).to eq(0)
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'does not show details for a detected issue sent by a user whose mention name is on the list' do
|
279
|
+
send_message('foo XYZ-987 bar', as: @user4)
|
280
|
+
expect(replies.size).to eq(0)
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'performs a search for multiple issues when more than one issue is detected' do
|
284
|
+
prev_format = registry.config.handlers.jira.format
|
285
|
+
registry.config.handlers.jira.format = 'one-line'
|
286
|
+
send_message('XYZ-987 XYZ-988')
|
287
|
+
registry.config.handlers.jira.format = prev_format
|
288
|
+
expect(replies.size).to eq(3)
|
289
|
+
expect(replies).to eq([
|
290
|
+
'Here are issues currently assigned to you:',
|
291
|
+
'http://jira.local/browse/XYZ-987 - In Progress, A Person - Some summary text',
|
292
|
+
'http://jira.local/browse/XYZ-988 - In Progress 2, A Person 2 - Some summary text 2'
|
293
|
+
])
|
294
|
+
end
|
295
|
+
|
296
|
+
it 'does not show details for multiple issues in URL-ish contexts' do
|
297
|
+
send_message('http://www.example.com/XYZ-987 http://www.example.com/XYZ-988')
|
298
|
+
send_message('http://www.example.com/XYZ-987.html http://www.example.com/XYZ-988.html')
|
299
|
+
expect(replies.size).to eq(0)
|
300
|
+
end
|
301
|
+
|
302
|
+
it 'does show details for a single issue when only one is not in a URL-ish context' do
|
303
|
+
send_message('http://www.example.com/XYZ-988 foo XYZ-987 bar http://www.example.com/XYZ-989', as: @user1)
|
304
|
+
expect(replies.size).to eq(1)
|
305
|
+
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
306
|
+
end
|
307
|
+
|
308
|
+
it 'does not show details for multiple detected issues sent by a user whose name is on the list' do
|
309
|
+
send_message('XYZ-987 XYZ-988', as: @user2)
|
310
|
+
expect(replies.size).to eq(0)
|
311
|
+
end
|
312
|
+
|
313
|
+
context 'with rooms configured' do
|
314
|
+
def send_room_message(body, room)
|
315
|
+
robot.receive(Lita::Message.new(robot, body, Lita::Source.new(user: user, room: room)))
|
231
316
|
end
|
232
317
|
|
233
|
-
|
234
|
-
|
235
|
-
|
318
|
+
before do
|
319
|
+
@room1 = 'Room1'
|
320
|
+
@room2 = 'Room2'
|
321
|
+
registry.config.handlers.jira.rooms = [@room1]
|
236
322
|
end
|
237
323
|
|
238
|
-
it '
|
239
|
-
|
240
|
-
|
241
|
-
send_message('http://www.example.com/someother-XYZ-987.html')
|
242
|
-
send_message('TIL http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-each_slice')
|
243
|
-
expect(replies.size).to eq(0)
|
324
|
+
it 'shows details for a detected issue sent in a room on the list' do
|
325
|
+
send_room_message('foo XYZ-987 bar', @room1)
|
326
|
+
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
244
327
|
end
|
245
328
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
@user2 = Lita::User.create('U2', name: 'User 2', mention_name: 'user2')
|
250
|
-
@user3 = Lita::User.create('U3', name: 'User 3', mention_name: 'user3')
|
251
|
-
@user4 = Lita::User.create('U4', name: 'User 4', mention_name: 'user4')
|
252
|
-
registry.config.handlers.jira.ignore = ['User 2', 'U3', 'user4']
|
253
|
-
end
|
254
|
-
|
255
|
-
it 'shows details for a detected issue sent by a user absent from the list' do
|
256
|
-
send_message('foo XYZ-987 bar', as: @user1)
|
257
|
-
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
258
|
-
end
|
259
|
-
|
260
|
-
it 'does not show details for a detected issue sent by a user whose name is on the list' do
|
261
|
-
send_message('foo XYZ-987 bar', as: @user2)
|
262
|
-
expect(replies.size).to eq(0)
|
263
|
-
end
|
264
|
-
|
265
|
-
it 'does not show details for a detected issue sent by a user whose ID is on the list' do
|
266
|
-
send_message('foo XYZ-987 bar', as: @user3)
|
267
|
-
expect(replies.size).to eq(0)
|
268
|
-
end
|
269
|
-
|
270
|
-
it 'does not show details for a detected issue sent by a user whose mention name is on the list' do
|
271
|
-
send_message('foo XYZ-987 bar', as: @user4)
|
272
|
-
expect(replies.size).to eq(0)
|
273
|
-
end
|
329
|
+
it 'does not show details for a detected issue sent in a room absent from the list' do
|
330
|
+
send_room_message('foo XYZ-987 bar', @room2)
|
331
|
+
expect(replies.size).to eq(0)
|
274
332
|
end
|
275
333
|
|
276
|
-
|
277
|
-
|
278
|
-
robot.receive(Lita::Message.new(robot, body, Lita::Source.new(user: user, room: room)))
|
279
|
-
end
|
280
|
-
|
281
|
-
before(:each) do
|
282
|
-
@room1 = 'Room1'
|
283
|
-
@room2 = 'Room2'
|
284
|
-
registry.config.handlers.jira.rooms = [@room1]
|
285
|
-
end
|
286
|
-
|
287
|
-
it 'shows details for a detected issue sent in a room on the list' do
|
288
|
-
send_room_message('foo XYZ-987 bar', @room1)
|
289
|
-
expect(replies.last).to eq("[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987")
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'does not show details for a detected issue sent in a room absent from the list' do
|
293
|
-
send_room_message('foo XYZ-987 bar', @room2)
|
294
|
-
expect(replies.size).to eq(0)
|
295
|
-
end
|
334
|
+
after do
|
335
|
+
registry.config.handlers.jira.rooms = []
|
296
336
|
end
|
297
337
|
end
|
298
338
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
|
-
require 'coveralls'
|
3
4
|
SimpleCov.formatters = [
|
4
|
-
SimpleCov::Formatter::HTMLFormatter
|
5
|
-
Coveralls::SimpleCov::Formatter
|
5
|
+
SimpleCov::Formatter::HTMLFormatter
|
6
6
|
]
|
7
7
|
SimpleCov.start { add_filter '/spec/' }
|
8
8
|
|
@@ -12,10 +12,21 @@ require 'lita/rspec'
|
|
12
12
|
Lita.version_3_compatibility_mode = false
|
13
13
|
|
14
14
|
RSpec.configure do |config|
|
15
|
-
config.
|
16
|
-
|
17
|
-
registry.register_handler(Lita::Handlers::JiraUtility)
|
15
|
+
config.expect_with :rspec do |expectations|
|
16
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
17
|
end
|
18
|
+
|
19
|
+
# TODO: Enable
|
20
|
+
# config.mock_with :rspec do |mocks|
|
21
|
+
# mocks.verify_partial_doubles = true
|
22
|
+
# end
|
23
|
+
|
24
|
+
config.filter_run :focus
|
25
|
+
config.run_all_when_everything_filtered = true
|
26
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
27
|
+
config.order = :random
|
28
|
+
|
29
|
+
Kernel.srand config.seed
|
19
30
|
end
|
20
31
|
|
21
32
|
def grab_request(result)
|
metadata
CHANGED
@@ -1,46 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Sigler
|
8
8
|
- Matt Critchlow
|
9
9
|
- Tristan Chong
|
10
10
|
- Lee Briggs
|
11
|
+
- Kenneth Kwan
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date:
|
15
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
18
|
+
name: jira-ruby
|
18
19
|
requirement: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
23
|
+
version: '0'
|
23
24
|
type: :runtime
|
24
25
|
prerelease: false
|
25
26
|
version_requirements: !ruby/object:Gem::Requirement
|
26
27
|
requirements:
|
27
28
|
- - ">="
|
28
29
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
+
version: '0'
|
30
31
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
32
|
+
name: lita
|
32
33
|
requirement: !ruby/object:Gem::Requirement
|
33
34
|
requirements:
|
34
35
|
- - ">="
|
35
36
|
- !ruby/object:Gem::Version
|
36
|
-
version: '0'
|
37
|
+
version: '4.0'
|
37
38
|
type: :runtime
|
38
39
|
prerelease: false
|
39
40
|
version_requirements: !ruby/object:Gem::Requirement
|
40
41
|
requirements:
|
41
42
|
- - ">="
|
42
43
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
44
|
+
version: '4.0'
|
44
45
|
- !ruby/object:Gem::Dependency
|
45
46
|
name: bundler
|
46
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,7 +57,7 @@ dependencies:
|
|
56
57
|
- !ruby/object:Gem::Version
|
57
58
|
version: '0'
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
+
name: rake
|
60
61
|
requirement: !ruby/object:Gem::Requirement
|
61
62
|
requirements:
|
62
63
|
- - ">="
|
@@ -70,7 +71,7 @@ dependencies:
|
|
70
71
|
- !ruby/object:Gem::Version
|
71
72
|
version: '0'
|
72
73
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
74
|
+
name: rspec
|
74
75
|
requirement: !ruby/object:Gem::Requirement
|
75
76
|
requirements:
|
76
77
|
- - ">="
|
@@ -84,7 +85,7 @@ dependencies:
|
|
84
85
|
- !ruby/object:Gem::Version
|
85
86
|
version: '0'
|
86
87
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
88
|
+
name: rubocop
|
88
89
|
requirement: !ruby/object:Gem::Requirement
|
89
90
|
requirements:
|
90
91
|
- - ">="
|
@@ -98,7 +99,7 @@ dependencies:
|
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
- !ruby/object:Gem::Dependency
|
101
|
-
name: rubocop
|
102
|
+
name: rubocop-rspec
|
102
103
|
requirement: !ruby/object:Gem::Requirement
|
103
104
|
requirements:
|
104
105
|
- - ">="
|
@@ -131,6 +132,7 @@ email:
|
|
131
132
|
- matt.critchlow@gmail.com
|
132
133
|
- ong@tristaneuan.ch
|
133
134
|
- lee@brig.gs
|
135
|
+
- kenneth.m.kwan@gmail.com
|
134
136
|
executables: []
|
135
137
|
extensions: []
|
136
138
|
extra_rdoc_files: []
|
@@ -138,6 +140,7 @@ files:
|
|
138
140
|
- ".gitignore"
|
139
141
|
- ".rspec"
|
140
142
|
- ".rubocop.yml"
|
143
|
+
- ".ruby-version"
|
141
144
|
- ".travis.yml"
|
142
145
|
- CHANGELOG.md
|
143
146
|
- CONTRIBUTING.md
|
@@ -154,6 +157,7 @@ files:
|
|
154
157
|
- lib/lita/handlers/jira_utility.rb
|
155
158
|
- lita-jira.gemspec
|
156
159
|
- locales/en.yml
|
160
|
+
- spec/jirahelper/regex_spec.rb
|
157
161
|
- spec/lita/handlers/jira_spec.rb
|
158
162
|
- spec/lita/handlers/jira_utility_spec.rb
|
159
163
|
- spec/spec_helper.rb
|
@@ -178,11 +182,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
182
|
version: '0'
|
179
183
|
requirements: []
|
180
184
|
rubyforge_project:
|
181
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.6.13
|
182
186
|
signing_key:
|
183
187
|
specification_version: 4
|
184
188
|
summary: A JIRA plugin for Lita.
|
185
189
|
test_files:
|
190
|
+
- spec/jirahelper/regex_spec.rb
|
186
191
|
- spec/lita/handlers/jira_spec.rb
|
187
192
|
- spec/lita/handlers/jira_utility_spec.rb
|
188
193
|
- spec/spec_helper.rb
|