jira-ruby 2.2.0 → 3.0.0.beta1
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/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/CI.yml +28 -0
- data/.github/workflows/codeql.yml +100 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.rubocop.yml +188 -0
- data/Gemfile +11 -3
- data/Guardfile +2 -0
- data/README.md +121 -20
- data/Rakefile +4 -5
- data/jira-ruby.gemspec +11 -17
- data/lib/jira/base.rb +37 -28
- data/lib/jira/base_factory.rb +4 -1
- data/lib/jira/client.rb +65 -46
- data/lib/jira/has_many_proxy.rb +4 -2
- data/lib/jira/http_client.rb +18 -13
- data/lib/jira/http_error.rb +4 -0
- data/lib/jira/jwt_client.rb +18 -42
- data/lib/jira/oauth_client.rb +6 -3
- data/lib/jira/railtie.rb +2 -0
- data/lib/jira/request_client.rb +5 -1
- data/lib/jira/resource/agile.rb +7 -9
- data/lib/jira/resource/applinks.rb +5 -3
- data/lib/jira/resource/attachment.rb +43 -3
- data/lib/jira/resource/board.rb +5 -3
- data/lib/jira/resource/board_configuration.rb +2 -0
- data/lib/jira/resource/comment.rb +2 -0
- data/lib/jira/resource/component.rb +2 -0
- data/lib/jira/resource/createmeta.rb +3 -1
- data/lib/jira/resource/field.rb +9 -4
- data/lib/jira/resource/filter.rb +2 -0
- data/lib/jira/resource/issue.rb +35 -44
- data/lib/jira/resource/issue_picker_suggestions.rb +4 -1
- data/lib/jira/resource/issue_picker_suggestions_issue.rb +2 -0
- data/lib/jira/resource/issuelink.rb +2 -0
- data/lib/jira/resource/issuelinktype.rb +2 -0
- data/lib/jira/resource/issuetype.rb +2 -0
- data/lib/jira/resource/priority.rb +2 -0
- data/lib/jira/resource/project.rb +4 -2
- data/lib/jira/resource/rapidview.rb +5 -3
- data/lib/jira/resource/remotelink.rb +2 -0
- data/lib/jira/resource/resolution.rb +2 -0
- data/lib/jira/resource/serverinfo.rb +2 -0
- data/lib/jira/resource/sprint.rb +14 -23
- data/lib/jira/resource/status.rb +7 -1
- data/lib/jira/resource/status_category.rb +10 -0
- data/lib/jira/resource/suggested_issue.rb +2 -0
- data/lib/jira/resource/transition.rb +2 -0
- data/lib/jira/resource/user.rb +3 -1
- data/lib/jira/resource/version.rb +2 -0
- data/lib/jira/resource/watcher.rb +2 -1
- data/lib/jira/resource/webhook.rb +4 -2
- data/lib/jira/resource/worklog.rb +3 -2
- data/lib/jira/version.rb +3 -1
- data/lib/jira-ruby.rb +5 -3
- data/lib/tasks/generate.rake +4 -2
- data/spec/data/files/short.txt +1 -0
- data/spec/integration/attachment_spec.rb +3 -3
- data/spec/integration/comment_spec.rb +8 -8
- data/spec/integration/component_spec.rb +7 -7
- data/spec/integration/field_spec.rb +3 -3
- data/spec/integration/issue_spec.rb +20 -16
- data/spec/integration/issuelinktype_spec.rb +3 -3
- data/spec/integration/issuetype_spec.rb +3 -3
- data/spec/integration/priority_spec.rb +3 -3
- data/spec/integration/project_spec.rb +7 -7
- data/spec/integration/rapidview_spec.rb +9 -9
- data/spec/integration/resolution_spec.rb +3 -3
- data/spec/integration/status_category_spec.rb +20 -0
- data/spec/integration/status_spec.rb +4 -8
- data/spec/integration/transition_spec.rb +2 -2
- data/spec/integration/user_spec.rb +22 -8
- data/spec/integration/version_spec.rb +7 -7
- data/spec/integration/watcher_spec.rb +17 -18
- data/spec/integration/webhook.rb +5 -4
- data/spec/integration/worklog_spec.rb +8 -8
- data/spec/jira/base_factory_spec.rb +2 -1
- data/spec/jira/base_spec.rb +55 -41
- data/spec/jira/client_spec.rb +48 -34
- data/spec/jira/has_many_proxy_spec.rb +3 -3
- data/spec/jira/http_client_spec.rb +98 -26
- data/spec/jira/http_error_spec.rb +2 -2
- data/spec/jira/oauth_client_spec.rb +30 -8
- data/spec/jira/request_client_spec.rb +4 -4
- data/spec/jira/resource/agile_spec.rb +28 -28
- data/spec/jira/resource/attachment_spec.rb +142 -52
- data/spec/jira/resource/board_spec.rb +21 -20
- data/spec/jira/resource/createmeta_spec.rb +48 -48
- data/spec/jira/resource/field_spec.rb +30 -12
- data/spec/jira/resource/filter_spec.rb +4 -4
- data/spec/jira/resource/issue_picker_suggestions_spec.rb +18 -18
- data/spec/jira/resource/issue_spec.rb +44 -38
- data/spec/jira/resource/jira_picker_suggestions_issue_spec.rb +3 -3
- data/spec/jira/resource/project_factory_spec.rb +3 -2
- data/spec/jira/resource/project_spec.rb +16 -16
- data/spec/jira/resource/sprint_spec.rb +70 -3
- data/spec/jira/resource/status_spec.rb +21 -0
- data/spec/jira/resource/user_factory_spec.rb +4 -4
- data/spec/jira/resource/worklog_spec.rb +3 -3
- data/spec/mock_responses/sprint/1.json +13 -0
- data/spec/mock_responses/status/1.json +8 -1
- data/spec/mock_responses/status.json +40 -5
- data/spec/mock_responses/statuscategory/1.json +7 -0
- data/spec/mock_responses/statuscategory.json +30 -0
- data/spec/mock_responses/{user_username=admin.json → user_accountId=1234567890abcdef01234567.json} +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/clients_helper.rb +3 -5
- data/spec/support/shared_examples/integration.rb +25 -28
- metadata +25 -257
- data/.travis.yml +0 -9
- data/example.rb +0 -232
- data/http-basic-example.rb +0 -113
- data/lib/jira/resource/sprint_report.rb +0 -8
- data/lib/jira/tasks.rb +0 -0
- data/spec/jira/jwt_uri_builder_spec.rb +0 -59
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe JIRA::Resource::Attachment do
|
|
4
4
|
subject(:attachment) do
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
described_class.new(
|
|
6
|
+
client,
|
|
7
|
+
issue: JIRA::Resource::Issue.new(client),
|
|
8
|
+
attrs: { 'author' => { 'foo' => 'bar' } }
|
|
9
9
|
)
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -35,12 +35,12 @@ describe JIRA::Resource::Attachment do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
describe '.meta' do
|
|
38
|
-
subject {
|
|
38
|
+
subject { described_class.meta(client) }
|
|
39
39
|
|
|
40
40
|
let(:response) do
|
|
41
41
|
double(
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
'response',
|
|
43
|
+
body: '{"enabled":true,"uploadLimit":10485760}'
|
|
44
44
|
)
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -59,79 +59,169 @@ describe JIRA::Resource::Attachment do
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
subject
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
"id": 10_001,
|
|
70
|
-
"self": 'http://www.example.com/jira/rest/api/2.0/attachments/10000',
|
|
71
|
-
"filename": 'picture.jpg',
|
|
72
|
-
"created": '2017-07-19T12:23:06.572+0000',
|
|
73
|
-
"size": 23_123,
|
|
74
|
-
"mimeType": 'image/jpeg'
|
|
75
|
-
}
|
|
76
|
-
].to_json
|
|
62
|
+
context 'there is an attachment on an issue' do
|
|
63
|
+
subject(:attachment) do
|
|
64
|
+
described_class.new(
|
|
65
|
+
client,
|
|
66
|
+
issue: JIRA::Resource::Issue.new(client),
|
|
67
|
+
attrs: { 'author' => { 'foo' => 'bar' }, 'content' => attachment_url }
|
|
77
68
|
)
|
|
78
69
|
end
|
|
79
|
-
|
|
70
|
+
|
|
71
|
+
let(:client) do
|
|
72
|
+
JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false)
|
|
73
|
+
end
|
|
74
|
+
let(:attachment_file_contents) { 'file contents' }
|
|
75
|
+
let(:attachment_url) { 'https://localhost:2990/secure/attachment/32323/myfile.txt' }
|
|
80
76
|
|
|
81
77
|
before do
|
|
82
|
-
|
|
78
|
+
stub_request(:get, attachment_url).to_return(body: attachment_file_contents)
|
|
83
79
|
end
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
describe '.download_file' do
|
|
82
|
+
it 'passes file object to block' do
|
|
83
|
+
expect(URI).to receive(:parse).with(attachment_url).and_call_original
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
attachment.download_file do |file|
|
|
86
|
+
expect(file.read).to eq(attachment_file_contents)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
91
89
|
end
|
|
92
|
-
end
|
|
93
90
|
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
describe '.download_contents' do
|
|
92
|
+
it 'downloads the file contents as a string' do
|
|
93
|
+
expect(URI).to receive(:parse).with(attachment_url).and_call_original
|
|
94
|
+
expect(attachment.download_contents).to eq(attachment_file_contents)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
context 'when there is a local file' do
|
|
100
|
+
let(:file_name) { 'short.txt' }
|
|
101
|
+
let(:file_size) { 11 }
|
|
102
|
+
let(:file_mime_type) { 'text/plain' }
|
|
103
|
+
let(:path_to_file) { "./spec/data/files/#{file_name}" }
|
|
98
104
|
let(:response) do
|
|
99
105
|
double(
|
|
100
106
|
body: [
|
|
101
107
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
id: 10_001,
|
|
109
|
+
self: 'http://www.example.com/jira/rest/api/2.0/attachments/10000',
|
|
110
|
+
filename: file_name,
|
|
111
|
+
created: '2017-07-19T12:23:06.572+0000',
|
|
112
|
+
size: file_size,
|
|
113
|
+
mimeType: file_mime_type
|
|
108
114
|
}
|
|
109
115
|
].to_json
|
|
110
116
|
)
|
|
111
117
|
end
|
|
112
118
|
let(:issue) { JIRA::Resource::Issue.new(client) }
|
|
113
119
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
end
|
|
120
|
+
describe '#save' do
|
|
121
|
+
subject { attachment.save('file' => path_to_file) }
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
before do
|
|
124
|
+
allow(client).to receive(:post_multipart).and_return(response)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'successfully update the attachment' do
|
|
128
|
+
subject
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
expect(attachment.filename).to eq file_name
|
|
131
|
+
expect(attachment.mimeType).to eq file_mime_type
|
|
132
|
+
expect(attachment.size).to eq file_size
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
context 'when using custom client headers' do
|
|
136
|
+
subject(:bearer_attachment) do
|
|
137
|
+
described_class.new(
|
|
138
|
+
bearer_client,
|
|
139
|
+
issue: JIRA::Resource::Issue.new(bearer_client),
|
|
140
|
+
attrs: { 'author' => { 'foo' => 'bar' } }
|
|
141
|
+
)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
let(:default_headers_given) do
|
|
145
|
+
{
|
|
146
|
+
'authorization' => 'Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2'
|
|
147
|
+
}
|
|
148
|
+
end
|
|
149
|
+
let(:bearer_client) do
|
|
150
|
+
JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false,
|
|
151
|
+
default_headers: default_headers_given)
|
|
152
|
+
end
|
|
153
|
+
let(:merged_headers) do
|
|
154
|
+
{
|
|
155
|
+
'Accept' => 'application/json',
|
|
156
|
+
'X-Atlassian-Token' => 'nocheck'
|
|
157
|
+
}.merge(default_headers_given)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it 'passes the custom headers' do
|
|
161
|
+
expect(bearer_client.request_client).to receive(:request_multipart)
|
|
162
|
+
.with(anything, anything, merged_headers)
|
|
163
|
+
.and_return(response)
|
|
164
|
+
|
|
165
|
+
bearer_attachment.save('file' => path_to_file)
|
|
166
|
+
end
|
|
167
|
+
end
|
|
124
168
|
end
|
|
125
169
|
|
|
126
|
-
|
|
127
|
-
subject { attachment.save!(file
|
|
170
|
+
describe '#save!' do
|
|
171
|
+
subject { attachment.save!('file' => path_to_file) }
|
|
172
|
+
|
|
173
|
+
before do
|
|
174
|
+
allow(client).to receive(:post_multipart).and_return(response)
|
|
175
|
+
end
|
|
128
176
|
|
|
129
177
|
it 'successfully update the attachment' do
|
|
130
178
|
subject
|
|
131
179
|
|
|
132
|
-
expect(attachment.filename).to eq
|
|
133
|
-
expect(attachment.mimeType).to eq
|
|
134
|
-
expect(attachment.size).to eq
|
|
180
|
+
expect(attachment.filename).to eq file_name
|
|
181
|
+
expect(attachment.mimeType).to eq file_mime_type
|
|
182
|
+
expect(attachment.size).to eq file_size
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
context 'when passing in a symbol as file key' do
|
|
186
|
+
subject { attachment.save!(file: path_to_file) }
|
|
187
|
+
|
|
188
|
+
it 'successfully update the attachment' do
|
|
189
|
+
subject
|
|
190
|
+
|
|
191
|
+
expect(attachment.filename).to eq file_name
|
|
192
|
+
expect(attachment.mimeType).to eq file_mime_type
|
|
193
|
+
expect(attachment.size).to eq file_size
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
context 'when using custom client headers' do
|
|
198
|
+
subject(:bearer_attachment) do
|
|
199
|
+
described_class.new(
|
|
200
|
+
bearer_client,
|
|
201
|
+
issue: JIRA::Resource::Issue.new(bearer_client),
|
|
202
|
+
attrs: { 'author' => { 'foo' => 'bar' } }
|
|
203
|
+
)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
let(:default_headers_given) { { 'authorization' => 'Bearer 83CF8B609DE60036A8277BD0E96135751BBC07EB234256D4B65B893360651BF2' } }
|
|
207
|
+
let(:bearer_client) do
|
|
208
|
+
JIRA::Client.new(username: 'username', password: 'password', auth_type: :basic, use_ssl: false,
|
|
209
|
+
default_headers: default_headers_given)
|
|
210
|
+
end
|
|
211
|
+
let(:merged_headers) do
|
|
212
|
+
{
|
|
213
|
+
'Accept' => 'application/json',
|
|
214
|
+
'X-Atlassian-Token' => 'nocheck'
|
|
215
|
+
}.merge(default_headers_given)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it 'passes the custom headers' do
|
|
219
|
+
expect(bearer_client.request_client).to receive(:request_multipart)
|
|
220
|
+
.with(anything, anything, merged_headers)
|
|
221
|
+
.and_return(response)
|
|
222
|
+
|
|
223
|
+
bearer_attachment.save!('file' => path_to_file)
|
|
224
|
+
end
|
|
135
225
|
end
|
|
136
226
|
end
|
|
137
227
|
end
|
|
@@ -21,16 +21,16 @@ describe JIRA::Resource::Board do
|
|
|
21
21
|
\"type\": \"scrum\"
|
|
22
22
|
}"
|
|
23
23
|
allow(response).to receive(:body).and_return(api_json_board)
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
allow(client).to receive(:get).with('/rest/agile/1.0/board/84')
|
|
25
|
+
.and_return(response)
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
allow(client).to receive(:Board).and_return(JIRA::Resource::BoardFactory.new(client))
|
|
28
|
+
described_class.find(client, '84')
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
it '
|
|
31
|
+
it 'finds all boards' do
|
|
32
32
|
response = double
|
|
33
|
-
api_json = <<
|
|
33
|
+
api_json = <<EOS
|
|
34
34
|
{
|
|
35
35
|
"maxResults": 50,
|
|
36
36
|
"startAt": 0,
|
|
@@ -48,24 +48,24 @@ describe JIRA::Resource::Board do
|
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
EOS
|
|
52
52
|
allow(response).to receive(:body).and_return(api_json)
|
|
53
53
|
expect(client).to receive(:get).with('/rest/agile/1.0/board')
|
|
54
54
|
.and_return(response)
|
|
55
55
|
expect(client).to receive(:Board).twice.and_return(JIRA::Resource::BoardFactory.new(client))
|
|
56
|
-
boards =
|
|
56
|
+
boards = described_class.all(client)
|
|
57
57
|
expect(boards.count).to eq(2)
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
it '
|
|
61
|
-
expect(board).to be_a(
|
|
60
|
+
it 'finds one board by id' do
|
|
61
|
+
expect(board).to be_a(described_class)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
describe '#issues' do
|
|
65
|
-
it '
|
|
65
|
+
it 'finds all issues' do
|
|
66
66
|
issues_response = double
|
|
67
67
|
|
|
68
|
-
api_json_issues = <<
|
|
68
|
+
api_json_issues = <<EOS
|
|
69
69
|
{
|
|
70
70
|
"expand": "names,schema",
|
|
71
71
|
"startAt": 0,
|
|
@@ -85,7 +85,7 @@ eos
|
|
|
85
85
|
}
|
|
86
86
|
]
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
EOS
|
|
89
89
|
|
|
90
90
|
allow(issues_response).to receive(:body).and_return(api_json_issues)
|
|
91
91
|
allow(board).to receive(:id).and_return(84)
|
|
@@ -98,6 +98,7 @@ eos
|
|
|
98
98
|
|
|
99
99
|
describe 'pagination' do
|
|
100
100
|
subject { described_class.new(client) }
|
|
101
|
+
|
|
101
102
|
let(:client) { JIRA::Client.new }
|
|
102
103
|
|
|
103
104
|
before do
|
|
@@ -147,10 +148,10 @@ eos
|
|
|
147
148
|
end
|
|
148
149
|
end
|
|
149
150
|
|
|
150
|
-
it '
|
|
151
|
+
it 'gets all sprints for a board' do
|
|
151
152
|
response = double
|
|
152
153
|
|
|
153
|
-
api_json = <<-
|
|
154
|
+
api_json = <<-EOS
|
|
154
155
|
{
|
|
155
156
|
"values": [
|
|
156
157
|
{
|
|
@@ -165,7 +166,7 @@ eos
|
|
|
165
166
|
}
|
|
166
167
|
]
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
+
EOS
|
|
169
170
|
allow(response).to receive(:body).and_return(api_json)
|
|
170
171
|
allow(board).to receive(:id).and_return(84)
|
|
171
172
|
expect(client).to receive(:get).with('/rest/agile/1.0/board/84/sprint?').and_return(response)
|
|
@@ -173,10 +174,10 @@ eos
|
|
|
173
174
|
expect(board.sprints.size).to be(2)
|
|
174
175
|
end
|
|
175
176
|
|
|
176
|
-
it '
|
|
177
|
+
it 'gets board configuration for a board' do
|
|
177
178
|
response = double
|
|
178
179
|
|
|
179
|
-
api_json = <<-
|
|
180
|
+
api_json = <<-EOS
|
|
180
181
|
{
|
|
181
182
|
"id":1,
|
|
182
183
|
"name":"My Board",
|
|
@@ -214,11 +215,11 @@ eos
|
|
|
214
215
|
"rankCustomFieldId":10011
|
|
215
216
|
}
|
|
216
217
|
}
|
|
217
|
-
|
|
218
|
+
EOS
|
|
218
219
|
allow(response).to receive(:body).and_return(api_json)
|
|
219
220
|
allow(board).to receive(:id).and_return(84)
|
|
220
221
|
expect(client).to receive(:get).with('/rest/agile/1.0/board/84/configuration').and_return(response)
|
|
221
222
|
expect(client).to receive(:BoardConfiguration).and_return(JIRA::Resource::BoardConfigurationFactory.new(client))
|
|
222
|
-
expect(board.configuration).not_to
|
|
223
|
+
expect(board.configuration).not_to be_nil
|
|
223
224
|
end
|
|
224
225
|
end
|
|
@@ -18,24 +18,24 @@ describe JIRA::Resource::Createmeta do
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
describe 'general' do
|
|
21
|
-
it '
|
|
21
|
+
it 'queries correct url without parameters' do
|
|
22
22
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta').and_return(response)
|
|
23
|
-
|
|
23
|
+
described_class.all(client)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
it '
|
|
26
|
+
it 'queries correct url with `expand` parameter' do
|
|
27
27
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields').and_return(response)
|
|
28
|
-
|
|
28
|
+
described_class.all(client, expand: 'projects.issuetypes.fields')
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
it '
|
|
31
|
+
it 'queries correct url with `foo` parameter' do
|
|
32
32
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?foo=bar').and_return(response)
|
|
33
|
-
|
|
33
|
+
described_class.all(client, foo: 'bar')
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
it '
|
|
36
|
+
it 'returns an array of createmeta objects' do
|
|
37
37
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta').and_return(response)
|
|
38
|
-
createmetas =
|
|
38
|
+
createmetas = described_class.all(client)
|
|
39
39
|
expect(createmetas).to be_an Array
|
|
40
40
|
createmeta = createmetas.first
|
|
41
41
|
expect(createmeta.id).to eq '10200'
|
|
@@ -45,52 +45,52 @@ describe JIRA::Resource::Createmeta do
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
describe 'projectKeys' do
|
|
48
|
-
it '
|
|
48
|
+
it 'queries correct url when only one `projectKeys` given as string' do
|
|
49
49
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1').and_return(response)
|
|
50
|
-
|
|
50
|
+
described_class.all(
|
|
51
51
|
client,
|
|
52
52
|
projectKeys: 'PROJECT_1'
|
|
53
53
|
)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
it '
|
|
56
|
+
it 'queries correct url when multiple `projectKeys` given as string' do
|
|
57
57
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPROJECT_2').and_return(response)
|
|
58
|
-
|
|
58
|
+
described_class.all(
|
|
59
59
|
client,
|
|
60
60
|
projectKeys: %w[PROJECT_1 PROJECT_2]
|
|
61
61
|
)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
it '
|
|
64
|
+
it 'queries correct url when only one `projectKeys` given as Project' do
|
|
65
65
|
prj = JIRA::Resource::Project.new(client)
|
|
66
66
|
allow(prj).to receive(:key).and_return('PRJ')
|
|
67
67
|
|
|
68
68
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ').and_return(response)
|
|
69
|
-
|
|
69
|
+
described_class.all(
|
|
70
70
|
client,
|
|
71
71
|
projectKeys: prj
|
|
72
72
|
)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
it '
|
|
75
|
+
it 'queries correct url when multiple `projectKeys` given as Project' do
|
|
76
76
|
prj_1 = JIRA::Resource::Project.new(client)
|
|
77
77
|
allow(prj_1).to receive(:key).and_return('PRJ_1')
|
|
78
78
|
prj_2 = JIRA::Resource::Project.new(client)
|
|
79
79
|
allow(prj_2).to receive(:key).and_return('PRJ_2')
|
|
80
80
|
|
|
81
81
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ_2%2CPRJ_1').and_return(response)
|
|
82
|
-
|
|
82
|
+
described_class.all(
|
|
83
83
|
client,
|
|
84
84
|
projectKeys: [prj_2, prj_1]
|
|
85
85
|
)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
it '
|
|
88
|
+
it 'queries correct url when multiple `projectKeys` given as different types' do
|
|
89
89
|
prj_5 = JIRA::Resource::Project.new(client)
|
|
90
90
|
allow(prj_5).to receive(:key).and_return('PRJ_5')
|
|
91
91
|
|
|
92
92
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPRJ_5').and_return(response)
|
|
93
|
-
|
|
93
|
+
described_class.all(
|
|
94
94
|
client,
|
|
95
95
|
projectKeys: ['PROJECT_1', prj_5]
|
|
96
96
|
)
|
|
@@ -98,52 +98,52 @@ describe JIRA::Resource::Createmeta do
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
describe 'projectIds' do
|
|
101
|
-
it '
|
|
101
|
+
it 'queries correct url when only one `projectIds` given as string' do
|
|
102
102
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101').and_return(response)
|
|
103
|
-
|
|
103
|
+
described_class.all(
|
|
104
104
|
client,
|
|
105
105
|
projectIds: '10101'
|
|
106
106
|
)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
-
it '
|
|
109
|
+
it 'queries correct url when multiple `projectIds` given as string' do
|
|
110
110
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C20202').and_return(response)
|
|
111
|
-
|
|
111
|
+
described_class.all(
|
|
112
112
|
client,
|
|
113
113
|
projectIds: %w[10101 20202]
|
|
114
114
|
)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
it '
|
|
117
|
+
it 'queries correct url when only one `projectIds` given as Project' do
|
|
118
118
|
prj = JIRA::Resource::Project.new(client)
|
|
119
119
|
allow(prj).to receive(:id).and_return('30303')
|
|
120
120
|
|
|
121
121
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=30303').and_return(response)
|
|
122
|
-
|
|
122
|
+
described_class.all(
|
|
123
123
|
client,
|
|
124
124
|
projectIds: prj
|
|
125
125
|
)
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
it '
|
|
128
|
+
it 'queries correct url when multiple `projectIds` given as Project' do
|
|
129
129
|
prj_1 = JIRA::Resource::Project.new(client)
|
|
130
130
|
allow(prj_1).to receive(:id).and_return('30303')
|
|
131
131
|
prj_2 = JIRA::Resource::Project.new(client)
|
|
132
132
|
allow(prj_2).to receive(:id).and_return('50505')
|
|
133
133
|
|
|
134
134
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=50505%2C30303').and_return(response)
|
|
135
|
-
|
|
135
|
+
described_class.all(
|
|
136
136
|
client,
|
|
137
137
|
projectIds: [prj_2, prj_1]
|
|
138
138
|
)
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
-
it '
|
|
141
|
+
it 'queries correct url when multiple `projectIds` given as different types' do
|
|
142
142
|
prj_5 = JIRA::Resource::Project.new(client)
|
|
143
143
|
allow(prj_5).to receive(:id).and_return('60606')
|
|
144
144
|
|
|
145
145
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C60606').and_return(response)
|
|
146
|
-
|
|
146
|
+
described_class.all(
|
|
147
147
|
client,
|
|
148
148
|
projectIds: ['10101', prj_5]
|
|
149
149
|
)
|
|
@@ -151,52 +151,52 @@ describe JIRA::Resource::Createmeta do
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
describe 'issuetypeNames' do
|
|
154
|
-
it '
|
|
154
|
+
it 'queries correct url when only one `issuetypeNames` given as string' do
|
|
155
155
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature').and_return(response)
|
|
156
|
-
|
|
156
|
+
described_class.all(
|
|
157
157
|
client,
|
|
158
158
|
issuetypeNames: 'Feature'
|
|
159
159
|
)
|
|
160
160
|
end
|
|
161
161
|
|
|
162
|
-
it '
|
|
162
|
+
it 'queries correct url when multiple `issuetypeNames` given as string' do
|
|
163
163
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CBug').and_return(response)
|
|
164
|
-
|
|
164
|
+
described_class.all(
|
|
165
165
|
client,
|
|
166
166
|
issuetypeNames: %w[Feature Bug]
|
|
167
167
|
)
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
-
it '
|
|
170
|
+
it 'queries correct url when only one `issuetypeNames` given as Issuetype' do
|
|
171
171
|
issue_type = JIRA::Resource::Issuetype.new(client)
|
|
172
172
|
allow(issue_type).to receive(:name).and_return('Epic')
|
|
173
173
|
|
|
174
174
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Epic').and_return(response)
|
|
175
|
-
|
|
175
|
+
described_class.all(
|
|
176
176
|
client,
|
|
177
177
|
issuetypeNames: issue_type
|
|
178
178
|
)
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
-
it '
|
|
181
|
+
it 'queries correct url when multiple `issuetypeNames` given as Issuetype' do
|
|
182
182
|
issue_type_1 = JIRA::Resource::Issuetype.new(client)
|
|
183
183
|
allow(issue_type_1).to receive(:name).and_return('Epic')
|
|
184
184
|
issue_type_2 = JIRA::Resource::Issuetype.new(client)
|
|
185
185
|
allow(issue_type_2).to receive(:name).and_return('Sub-Task')
|
|
186
186
|
|
|
187
187
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Sub-Task%2CEpic').and_return(response)
|
|
188
|
-
|
|
188
|
+
described_class.all(
|
|
189
189
|
client,
|
|
190
190
|
issuetypeNames: [issue_type_2, issue_type_1]
|
|
191
191
|
)
|
|
192
192
|
end
|
|
193
193
|
|
|
194
|
-
it '
|
|
194
|
+
it 'queries correct url when multiple `issuetypeNames` given as different types' do
|
|
195
195
|
issue_type = JIRA::Resource::Issuetype.new(client)
|
|
196
196
|
allow(issue_type).to receive(:name).and_return('Epic')
|
|
197
197
|
|
|
198
198
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CEpic').and_return(response)
|
|
199
|
-
|
|
199
|
+
described_class.all(
|
|
200
200
|
client,
|
|
201
201
|
issuetypeNames: ['Feature', issue_type]
|
|
202
202
|
)
|
|
@@ -204,52 +204,52 @@ describe JIRA::Resource::Createmeta do
|
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
describe 'issuetypeIds' do
|
|
207
|
-
it '
|
|
207
|
+
it 'queries correct url when only one `issuetypeIds` given as string' do
|
|
208
208
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101').and_return(response)
|
|
209
|
-
|
|
209
|
+
described_class.all(
|
|
210
210
|
client,
|
|
211
211
|
issuetypeIds: '10101'
|
|
212
212
|
)
|
|
213
213
|
end
|
|
214
214
|
|
|
215
|
-
it '
|
|
215
|
+
it 'queries correct url when multiple `issuetypeIds` given as string' do
|
|
216
216
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C20202').and_return(response)
|
|
217
|
-
|
|
217
|
+
described_class.all(
|
|
218
218
|
client,
|
|
219
219
|
issuetypeIds: %w[10101 20202]
|
|
220
220
|
)
|
|
221
221
|
end
|
|
222
222
|
|
|
223
|
-
it '
|
|
223
|
+
it 'queries correct url when only one `issuetypeIds` given as Issuetype' do
|
|
224
224
|
issue_type = JIRA::Resource::Issuetype.new(client)
|
|
225
225
|
allow(issue_type).to receive(:id).and_return('30303')
|
|
226
226
|
|
|
227
227
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=30303').and_return(response)
|
|
228
|
-
|
|
228
|
+
described_class.all(
|
|
229
229
|
client,
|
|
230
230
|
issuetypeIds: issue_type
|
|
231
231
|
)
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
-
it '
|
|
234
|
+
it 'queries correct url when multiple `issuetypeIds` given as Issuetype' do
|
|
235
235
|
issue_type_1 = JIRA::Resource::Issuetype.new(client)
|
|
236
236
|
allow(issue_type_1).to receive(:id).and_return('30303')
|
|
237
237
|
issue_type_2 = JIRA::Resource::Issuetype.new(client)
|
|
238
238
|
allow(issue_type_2).to receive(:id).and_return('50505')
|
|
239
239
|
|
|
240
240
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=50505%2C30303').and_return(response)
|
|
241
|
-
|
|
241
|
+
described_class.all(
|
|
242
242
|
client,
|
|
243
243
|
issuetypeIds: [issue_type_2, issue_type_1]
|
|
244
244
|
)
|
|
245
245
|
end
|
|
246
246
|
|
|
247
|
-
it '
|
|
247
|
+
it 'queries correct url when multiple `issuetypeIds` given as different types' do
|
|
248
248
|
issue_type = JIRA::Resource::Issuetype.new(client)
|
|
249
249
|
allow(issue_type).to receive(:id).and_return('30303')
|
|
250
250
|
|
|
251
251
|
expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C30303').and_return(response)
|
|
252
|
-
|
|
252
|
+
described_class.all(
|
|
253
253
|
client,
|
|
254
254
|
issuetypeIds: ['10101', issue_type]
|
|
255
255
|
)
|