lita-jira-issues 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/jira_issues.rb +2 -1
- data/lita-jira-issues.gemspec +1 -1
- data/spec/lita/handlers/jira_issues_spec.rb +32 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5289a8db7eaaeaec996dae6be0bb5d87fb692c6c
|
4
|
+
data.tar.gz: 175e27ae92770ae373629b85300cff41e978d558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1b42b22ed8a1474faf9a08af9e945b258500c7262ee4e6d46ad426bdbf7764c5ef79797a029d0303db41eacb6b011ee9dc7d88142ae05f0fa35fcf8b05f4ac
|
7
|
+
data.tar.gz: 3c421fa192c00a884798d3f111941a3f2e9311e82a3e081c06af4420d6c60c5af652662d0ac1f802b061fd55ec3a5a187ceb97d5bbe816c4313d9c651a43e31c
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'jira_gateway'
|
2
|
+
require 'set'
|
2
3
|
|
3
4
|
module Lita
|
4
5
|
module Handlers
|
@@ -14,7 +15,7 @@ module Lita
|
|
14
15
|
|
15
16
|
def jira_message(response)
|
16
17
|
@jira ||= JiraGateway.new(http, config)
|
17
|
-
response.matches.each do | key |
|
18
|
+
Set.new(response.matches).each do | key |
|
18
19
|
handle_key(response, key)
|
19
20
|
end
|
20
21
|
end
|
data/lita-jira-issues.gemspec
CHANGED
@@ -41,6 +41,38 @@ http://jira.local/browse/KEY-424
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'it should reply with multiple JIRA descriptions if many seen' do
|
44
|
+
mock_multiple_jiras
|
45
|
+
send_message('Some PROJ-9872 message nEw-1 more text')
|
46
|
+
expect(replies.pop).to eq(<<-EOS.chomp
|
47
|
+
[NEW-1] New 1
|
48
|
+
Status: Open, unassigned, rep. by User2, fixVersion: NONE, priority: High
|
49
|
+
http://jira.local/browse/NEW-1
|
50
|
+
EOS
|
51
|
+
)
|
52
|
+
expect(replies.pop).to eq(<<-EOS.chomp
|
53
|
+
[PROJ-9872] Too many bugs
|
54
|
+
Status: Resolved, unassigned, rep. by User, fixVersion: NONE
|
55
|
+
http://jira.local/browse/PROJ-9872
|
56
|
+
EOS
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'it should reply once for each seen JIRA issue' do
|
61
|
+
mock_multiple_jiras
|
62
|
+
send_message(
|
63
|
+
'Some PROJ-9872 message nEw-1 more text with PROJ-9872 mentioned')
|
64
|
+
expect(replies.size).to eq(2)
|
65
|
+
expect(replies.pop).to include('[NEW-1] New 1')
|
66
|
+
expect(replies.pop).to include('[PROJ-9872] Too many bugs')
|
67
|
+
end
|
68
|
+
|
69
|
+
def mock_jira(key, result)
|
70
|
+
allow_any_instance_of(JiraGateway).to receive(:data_for_issue)
|
71
|
+
.with(key)
|
72
|
+
.and_return(result)
|
73
|
+
end
|
74
|
+
|
75
|
+
def mock_multiple_jiras
|
44
76
|
mock_jira('PROJ-9872',
|
45
77
|
{key:'PROJ-9872',
|
46
78
|
fields: {
|
@@ -66,26 +98,6 @@ http://jira.local/browse/KEY-424
|
|
66
98
|
fixVersions: [],
|
67
99
|
priority: { name: 'High' }
|
68
100
|
}})
|
69
|
-
|
70
|
-
send_message('Some PROJ-9872 message nEw-1 more text')
|
71
|
-
expect(replies.pop).to eq(<<-EOS.chomp
|
72
|
-
[NEW-1] New 1
|
73
|
-
Status: Open, unassigned, rep. by User2, fixVersion: NONE, priority: High
|
74
|
-
http://jira.local/browse/NEW-1
|
75
|
-
EOS
|
76
|
-
)
|
77
|
-
expect(replies.pop).to eq(<<-EOS.chomp
|
78
|
-
[PROJ-9872] Too many bugs
|
79
|
-
Status: Resolved, unassigned, rep. by User, fixVersion: NONE
|
80
|
-
http://jira.local/browse/PROJ-9872
|
81
|
-
EOS
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
def mock_jira(key, result)
|
86
|
-
allow_any_instance_of(JiraGateway).to receive(:data_for_issue)
|
87
|
-
.with(key)
|
88
|
-
.and_return(result)
|
89
101
|
end
|
90
102
|
|
91
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-jira-issues
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Maltson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|