danger-yajp 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/README.md +1 -1
- data/lib/yajp/gem_version.rb +1 -1
- data/lib/yajp/plugin.rb +4 -2
- data/spec/yajp_spec.rb +25 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ad66f844e895f7e409c0576a5acb92cc040e19ae1aa1c5bb0e2cf2905bb144
|
4
|
+
data.tar.gz: 4f0f8c655b370ecfbdf3f180400a63ec4b1beff3e1acd48f9737381f88c0a096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07a845fb824464a06a159419cf72580c7cd25867d18db56d61348dd097c42becfac016a9cc306648e42891d09a9ef66759a8c573dabf91fc92eb744f55f2b8f
|
7
|
+
data.tar.gz: 48363be1c7b1d43659268b0447c81d1ed0c994a8445f319f6c4cc3544862c98f5ef76e4413e4d39ad0eaf0cd1d333ba382d5d085c12f1162ec7623411178c3c7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-yajp (0.0.
|
4
|
+
danger-yajp (0.0.2)
|
5
5
|
danger-plugin-api
|
6
6
|
jira-ruby
|
7
7
|
|
@@ -115,19 +115,19 @@ GEM
|
|
115
115
|
rchardet (1.8.0)
|
116
116
|
regexp_parser (1.8.2)
|
117
117
|
rexml (3.2.4)
|
118
|
-
rspec (3.
|
119
|
-
rspec-core (~> 3.
|
120
|
-
rspec-expectations (~> 3.
|
121
|
-
rspec-mocks (~> 3.
|
122
|
-
rspec-core (3.
|
123
|
-
rspec-support (~> 3.
|
124
|
-
rspec-expectations (3.
|
118
|
+
rspec (3.10.0)
|
119
|
+
rspec-core (~> 3.10.0)
|
120
|
+
rspec-expectations (~> 3.10.0)
|
121
|
+
rspec-mocks (~> 3.10.0)
|
122
|
+
rspec-core (3.10.0)
|
123
|
+
rspec-support (~> 3.10.0)
|
124
|
+
rspec-expectations (3.10.0)
|
125
125
|
diff-lcs (>= 1.2.0, < 2.0)
|
126
|
-
rspec-support (~> 3.
|
127
|
-
rspec-mocks (3.
|
126
|
+
rspec-support (~> 3.10.0)
|
127
|
+
rspec-mocks (3.10.0)
|
128
128
|
diff-lcs (>= 1.2.0, < 2.0)
|
129
|
-
rspec-support (~> 3.
|
130
|
-
rspec-support (3.
|
129
|
+
rspec-support (~> 3.10.0)
|
130
|
+
rspec-support (3.10.0)
|
131
131
|
rubocop (1.0.0)
|
132
132
|
parallel (~> 1.10)
|
133
133
|
parser (>= 2.7.1.5)
|
@@ -137,7 +137,7 @@ GEM
|
|
137
137
|
rubocop-ast (>= 0.6.0)
|
138
138
|
ruby-progressbar (~> 1.7)
|
139
139
|
unicode-display_width (>= 1.4.0, < 2.0)
|
140
|
-
rubocop-ast (1.1.
|
140
|
+
rubocop-ast (1.1.1)
|
141
141
|
parser (>= 2.7.1.5)
|
142
142
|
ruby-progressbar (1.10.1)
|
143
143
|
ruby2_keywords (0.0.2)
|
data/README.md
CHANGED
@@ -84,7 +84,7 @@ else
|
|
84
84
|
issues.each do |issue|
|
85
85
|
message "<a href='#{jira.issue_link(issue)}'>#{issue.key} - #{issue.summary}</a>"
|
86
86
|
|
87
|
-
case issue.status
|
87
|
+
case issue.status.name
|
88
88
|
when 'In Progress'
|
89
89
|
jira.transition_and_update(issue, 10, assignee: { name: 'username' }, customfield_11005: 'example')
|
90
90
|
when 'To Do', 'Blocked'
|
data/lib/yajp/gem_version.rb
CHANGED
data/lib/yajp/plugin.rb
CHANGED
@@ -20,7 +20,7 @@ module Danger
|
|
20
20
|
# issues.each do |issue|
|
21
21
|
# message "<a href='#{jira.issue_link(issue)}'>#{issue.key} - #{issue.summary}</a>"
|
22
22
|
#
|
23
|
-
# case issue.status
|
23
|
+
# case issue.status.name
|
24
24
|
# when 'In Progress'
|
25
25
|
# jira.transition_and_update(issue, 10, assignee: { name: 'username' }, customfield_11005: 'example')
|
26
26
|
# when 'To Do', 'Blocked'
|
@@ -129,8 +129,10 @@ module Danger
|
|
129
129
|
result = true
|
130
130
|
|
131
131
|
issues.each do |key|
|
132
|
-
result &= key.save(fields)
|
132
|
+
result &= key.save({ fields: fields })
|
133
133
|
end
|
134
|
+
|
135
|
+
return result
|
134
136
|
end
|
135
137
|
|
136
138
|
# Utility to split the given fields into fields that can be updated on the transition screen corresponding to the `transition_id` of the given `issue`.
|
data/spec/yajp_spec.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spec_helper'
|
4
4
|
|
5
5
|
module Danger
|
6
6
|
describe Danger::DangerYajp do
|
7
|
+
before do
|
8
|
+
ENV['DANGER_JIRA_URL'] = 'https://jira.company.com/jira'
|
9
|
+
ENV['DANGER_JIRA_USER'] = 'username'
|
10
|
+
ENV['DANGER_JIRA_PASSWORD'] = 'password'
|
11
|
+
end
|
12
|
+
|
7
13
|
it 'should be a plugin' do
|
8
14
|
expect(Danger::DangerYajp.new(nil)).to be_a Danger::Plugin
|
9
15
|
end
|
@@ -13,9 +19,6 @@ module Danger
|
|
13
19
|
let(:plugin) { dangerfile.jira }
|
14
20
|
|
15
21
|
before do
|
16
|
-
ENV['DANGER_JIRA_URL'] = 'https://jira.company.com/jira'
|
17
|
-
ENV['DANGER_JIRA_USER'] = 'username'
|
18
|
-
ENV['DANGER_JIRA_PASSWORD'] = 'password'
|
19
22
|
DangerYajp.send(:public, *DangerYajp.private_instance_methods)
|
20
23
|
end
|
21
24
|
|
@@ -92,9 +95,26 @@ module Danger
|
|
92
95
|
allow(issue).to receive(:key_value).and_return('WEB-131')
|
93
96
|
stub = stub_request(:post, url).
|
94
97
|
with(body: expected_json)
|
95
|
-
plugin.transition(issue, 2, assignee: { name: 'username' }, customfield_11005: 'example')
|
98
|
+
result = plugin.transition(issue, 2, assignee: { name: 'username' }, customfield_11005: 'example')
|
96
99
|
|
97
100
|
expect(stub).to have_been_requested.once
|
101
|
+
expect(result).to be true
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'can update issues' do
|
105
|
+
expected_json = '{"fields":{"assignee":{"name":"username"},"customfield_11005":"example"}}'
|
106
|
+
uri_template = Addressable::Template.new "#{ENV['DANGER_JIRA_URL']}/rest/api/2/issue/{issue}"
|
107
|
+
issue1 = plugin.api.Issue.build
|
108
|
+
issue2 = plugin.api.Issue.build
|
109
|
+
|
110
|
+
allow(issue1).to receive(:key_value).and_return('WEB-132')
|
111
|
+
allow(issue2).to receive(:key_value).and_return('WEB-133')
|
112
|
+
stub = stub_request(:put, uri_template).
|
113
|
+
with(body: expected_json)
|
114
|
+
result = plugin.update([issue1, issue2], assignee: { name: 'username' }, customfield_11005: 'example')
|
115
|
+
|
116
|
+
expect(stub).to have_been_requested.twice
|
117
|
+
expect(result).to be true
|
98
118
|
end
|
99
119
|
end
|
100
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-yajp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juliendms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|