jira-ruby 0.1.17 → 1.0.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.
@@ -0,0 +1,52 @@
1
+ module JIRA
2
+ module Resource
3
+
4
+ class CreatemetaFactory < JIRA::BaseFactory # :nodoc:
5
+ end
6
+
7
+ class Createmeta < JIRA::Base
8
+ def self.endpoint_name
9
+ '/issue/createmeta'
10
+ end
11
+
12
+ def self.all(client, params={})
13
+
14
+ if params.has_key?(:projectKeys)
15
+ values = Array(params[:projectKeys]).map{|i| (i.is_a?(JIRA::Resource::Project) ? i.key : i)}
16
+ params[:projectKeys] = values.join(',')
17
+ end
18
+
19
+ if params.has_key?(:projectIds)
20
+ values = Array(params[:projectIds]).map{|i| (i.is_a?(JIRA::Resource::Project) ? i.id : i)}
21
+ params[:projectIds] = values.join(',')
22
+ end
23
+
24
+ if params.has_key?(:issuetypeNames)
25
+ values = Array(params[:issuetypeNames]).map{|i| (i.is_a?(JIRA::Resource::Issuetype) ? i.name : i)}
26
+ params[:issuetypeNames] = values.join(',')
27
+ end
28
+
29
+ if params.has_key?(:issuetypeIds)
30
+ values = Array(params[:issuetypeIds]).map{|i| (i.is_a?(JIRA::Resource::Issuetype) ? i.id : i)}
31
+ params[:issuetypeIds] = values.join(',')
32
+ end
33
+
34
+ create_meta_url = client.options[:rest_base_path] + self.endpoint_name
35
+ params = hash_to_query_string(params)
36
+
37
+ response = params.empty? ? client.get("#{create_meta_url}") : client.get("#{create_meta_url}?#{params}")
38
+
39
+ json = parse_json(response.body)
40
+ self.new(client, {:attrs => json['projects']})
41
+ end
42
+
43
+ def self.hash_to_query_string(query_params)
44
+ query_params.map do |k,v|
45
+ CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s)
46
+ end.join('&')
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+ end
@@ -2,9 +2,82 @@ module JIRA
2
2
  module Resource
3
3
 
4
4
  class FieldFactory < JIRA::BaseFactory # :nodoc:
5
+ delegate_to_target_class :map_fields, :name_to_id, :field_map
5
6
  end
6
7
 
7
- class Field < JIRA::Base ; end
8
+ class Field < JIRA::Base
8
9
 
10
+ #translate a custom field description to a method-safe name
11
+ def self.safe_name(description)
12
+ description.gsub(/[^a-zA-Z0-9]/,'_')
13
+ end
14
+
15
+ # safe_name plus disambiguation if it fails it uses the original jira id (customfield_#####)
16
+ def self.safer_name(description, jira_id)
17
+ "#{safe_name(description)}_#{jira_id.split('_')[1]}" rescue jira_id
18
+ end
19
+
20
+ def self.map_fields(client)
21
+ field_map = {}
22
+ field_map_reverse = {}
23
+ fields = client.Field.all
24
+
25
+ # two pass approach, so that a custom field with the same name
26
+ # as a system field can't take precedence
27
+ fields.each do |f|
28
+ next if f.custom
29
+ name = safe_name(f.name)
30
+ field_map_reverse[f.id] = [f.name, name] # capture both the official name, and the mapped name
31
+ field_map[name] = f.id
32
+ end
33
+
34
+ fields.each do |f|
35
+ next unless f.custom
36
+ name = if field_map.key? f.name
37
+ renamed = safer_name(f.name, f.id)
38
+ warn "Duplicate Field name #{f.name} #{f.id} - renaming as #{renamed}"
39
+ renamed
40
+ else
41
+ safe_name(f.name)
42
+ end
43
+ field_map_reverse[f.id] = [f.name, name] # capture both the official name, and the mapped name
44
+ field_map[name] = f.id
45
+ end
46
+
47
+ client.cache.field_map_reverse = field_map_reverse # not sure where this will be used yet, but sure to be useful
48
+ client.cache.field_map = field_map
49
+ end
50
+
51
+ def self.field_map(client)
52
+ client.cache.field_map
53
+ end
54
+
55
+ def self.name_to_id(client, field_name)
56
+ field_name = field_name.to_s
57
+ return field_name unless client.cache.field_map && client.cache.field_map[field_name]
58
+ client.cache.field_map[field_name]
59
+ end
60
+
61
+ def respond_to?(method_name, include_all=false)
62
+ if [method_name.to_s, client.Field.name_to_id(method_name)].any? {|k| attrs.key?(k)}
63
+ true
64
+ else
65
+ super(method_name)
66
+ end
67
+ end
68
+
69
+ def method_missing(method_name, *args, &block)
70
+ if attrs.keys.include?(method_name.to_s)
71
+ attrs[method_name.to_s]
72
+ else
73
+ official_name=client.Field.name_to_id(method_name)
74
+ if attrs.keys.include?(official_name)
75
+ attrs[official_name]
76
+ else
77
+ super(method_name, *args, &block)
78
+ end
79
+ end
80
+ end
81
+ end
9
82
  end
10
83
  end
@@ -51,7 +51,7 @@ module JIRA
51
51
  def self.jql(client, jql, options = {fields: nil, start_at: nil, max_results: nil, expand: nil})
52
52
  url = client.options[:rest_base_path] + "/search?jql=" + CGI.escape(jql)
53
53
 
54
- url << "&fields=#{options[:fields].map{ |value| CGI.escape(value.to_s) }.join(',')}" if options[:fields]
54
+ url << "&fields=#{options[:fields].map{ |value| CGI.escape(client.Field.name_to_id(value)) }.join(',')}" if options[:fields]
55
55
  url << "&startAt=#{CGI.escape(options[:start_at].to_s)}" if options[:start_at]
56
56
  url << "&maxResults=#{CGI.escape(options[:max_results].to_s)}" if options[:max_results]
57
57
 
@@ -67,8 +67,16 @@ module JIRA
67
67
  end
68
68
  end
69
69
 
70
+ def editmeta
71
+ editmeta_url = client.options[:rest_base_path] + "/#{self.class.endpoint_name}/#{key}/editmeta"
72
+
73
+ response = client.get(editmeta_url)
74
+ json = self.class.parse_json(response.body)
75
+ json['fields']
76
+ end
77
+
70
78
  def respond_to?(method_name, include_all=false)
71
- if attrs.keys.include?('fields') && attrs['fields'].keys.include?(method_name.to_s)
79
+ if attrs.keys.include?('fields') && [method_name.to_s, client.Field.name_to_id(method_name)].any? {|k| attrs['fields'].key?(k)}
72
80
  true
73
81
  else
74
82
  super(method_name)
@@ -76,10 +84,19 @@ module JIRA
76
84
  end
77
85
 
78
86
  def method_missing(method_name, *args, &block)
79
- if attrs.keys.include?('fields') && attrs['fields'].keys.include?(method_name.to_s)
80
- attrs['fields'][method_name.to_s]
87
+ if attrs.keys.include?('fields')
88
+ if attrs['fields'].keys.include?(method_name.to_s)
89
+ attrs['fields'][method_name.to_s]
90
+ else
91
+ official_name=client.Field.name_to_id(method_name)
92
+ if attrs['fields'].keys.include?(official_name)
93
+ attrs['fields'][official_name]
94
+ else
95
+ super(method_name, *args, &block)
96
+ end
97
+ end
81
98
  else
82
- super(method_name)
99
+ super(method_name, *args, &block)
83
100
  end
84
101
  end
85
102
 
@@ -0,0 +1,10 @@
1
+ module JIRA
2
+ module Resource
3
+
4
+ class ResolutionFactory < JIRA::BaseFactory # :nodoc:
5
+ end
6
+
7
+ class Resolution < JIRA::Base ; end
8
+
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ require 'cgi'
2
+
3
+ module JIRA
4
+ module Resource
5
+
6
+ class SprintFactory < JIRA::BaseFactory # :nodoc:
7
+ end
8
+
9
+ class Sprint < JIRA::Base
10
+
11
+ def self.all(client, key)
12
+ response = client.get(path_base(client) + '/sprintquery/' + key.to_s)
13
+ parse_json(response.body)
14
+ end
15
+
16
+ def self.find(client, key, options = {})
17
+ options[:maxResults] ||= 100
18
+ fields = options[:fields].join(',') unless options[:fields].nil?
19
+ response = client.get("/rest/api/latest/search?jql=sprint=#{key}&fields=#{fields}&maxResults=#{options[:maxResults]}")
20
+ parse_json(response.body)
21
+ end
22
+
23
+ private
24
+
25
+ def self.path_base(client)
26
+ client.options[:context_path] + '/rest/greenhopper/1.0'
27
+ end
28
+
29
+ def path_base(client)
30
+ self.class.path_base(client)
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
@@ -2,6 +2,12 @@ module JIRA
2
2
  module Resource
3
3
 
4
4
  class UserFactory < JIRA::BaseFactory # :nodoc:
5
+ def myself
6
+ instance = build
7
+ response = client.get("#{client.options[:rest_base_path]}/myself")
8
+ instance.set_attrs_from_response(response)
9
+ instance
10
+ end
5
11
  end
6
12
 
7
13
  class User < JIRA::Base
@@ -0,0 +1,40 @@
1
+ module JIRA
2
+ module Resource
3
+
4
+ class WebhookFactory < JIRA::BaseFactory # :nodoc:
5
+ end
6
+
7
+ class Webhook < JIRA::Base
8
+
9
+ REST_BASE_PATH = '/rest/webhooks/1.0'
10
+
11
+ def self.endpoint_name
12
+ 'webhook'
13
+ end
14
+
15
+ def self.full_url(client)
16
+ client.options[:context_path] + REST_BASE_PATH
17
+ end
18
+
19
+ def self.collection_path(client, prefix = '/')
20
+ self.full_url(client) + prefix + self.endpoint_name
21
+ end
22
+
23
+ def self.all(client, options = {})
24
+ response = client.get(collection_path(client))
25
+ json = parse_json(response.body)
26
+ json.map do |attrs|
27
+ self.new(client, {:attrs => attrs}.merge(options))
28
+ end
29
+ end
30
+
31
+ # def self.save(options={})
32
+ # end
33
+
34
+ # def self.delete(options={})
35
+
36
+ # end
37
+
38
+ end
39
+ end
40
+ end
data/lib/jira/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = "0.1.17"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::Resolution do
4
+
5
+ with_each_client do |site_url, client|
6
+ let(:client) { client }
7
+ let(:site_url) { site_url }
8
+
9
+
10
+ let(:key) { "1" }
11
+
12
+ let(:expected_attributes) do
13
+ {
14
+ 'self' => "http://www.example.com/jira/rest/api/2/resolution/1",
15
+ 'id' => key,
16
+ 'name' => 'Fixed',
17
+ 'description' => 'A fix for this issue is checked into the tree and tested.',
18
+ 'iconUrl' => 'http://www.example.com/jira/images/icons/status_resolved.gif'
19
+ }
20
+ end
21
+
22
+ let(:expected_collection_length) { 2 }
23
+
24
+ it_should_behave_like "a resource"
25
+ it_should_behave_like "a resource with a collection GET endpoint"
26
+ it_should_behave_like "a resource with a singular GET endpoint"
27
+
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::Webhook do
4
+
5
+ with_each_client do |site_url, client|
6
+ let(:client) { client }
7
+ let(:site_url) { site_url }
8
+
9
+
10
+ let(:key) { "2" }
11
+
12
+ let(:expected_attributes) do
13
+ {"name"=>"from API", "url"=>"http://localhost:3000/webhooks/1", "excludeBody"=>false, "filters"=>{"issue-related-events-section"=>""}, "events"=>[], "enabled"=>true, "self"=>"http://localhost:2990/jira/rest/webhooks/1.0/webhook/2", "lastUpdatedUser"=>"admin", "lastUpdatedDisplayName"=>"admin", "lastUpdated"=>1453306520188}
14
+ end
15
+
16
+ let(:expected_collection_length) { 1 }
17
+
18
+ it_should_behave_like "a resource"
19
+ it_should_behave_like "a resource with a collection GET endpoint"
20
+ it_should_behave_like "a resource with a singular GET endpoint"
21
+
22
+
23
+
24
+ it "returns a collection of components" do
25
+
26
+ stub_request(:get, site_url + described_class.singular_path(client, key)).
27
+ to_return(:status => 200, :body => get_mock_response('webhook/webhook.json'))
28
+
29
+
30
+
31
+
32
+ end
33
+ end
34
+ end
@@ -427,9 +427,12 @@ describe JIRA::Base do
427
427
  end
428
428
 
429
429
  it "converts to json" do
430
- subject.attrs = {"foo" => "bar","dead" => "beef"}
431
-
430
+ subject.attrs = { 'foo' => 'bar', 'dead' => 'beef' }
432
431
  expect(subject.to_json).to eq(subject.attrs.to_json)
432
+
433
+ h = { 'key' => subject }
434
+ h_attrs = { 'key' => subject.attrs }
435
+ expect(h.to_json).to eq(h_attrs.to_json)
433
436
  end
434
437
 
435
438
  describe "extract attrs from response" do
@@ -0,0 +1,253 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::Createmeta do
4
+ let(:client) {
5
+ double(
6
+ 'client',
7
+ :options => {
8
+ :rest_base_path => '/jira/rest/api/2'
9
+ }
10
+ )
11
+ }
12
+
13
+ let(:response) {
14
+ double(
15
+ 'response',
16
+ :body => '{"expand":"projects","projects":[{"self":"http://localhost:2029/rest/api/2/project/TST"}]}'
17
+ )
18
+ }
19
+
20
+ describe 'general' do
21
+ it 'should query correct url without parameters' do
22
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta').and_return(response)
23
+ JIRA::Resource::Createmeta.all(client)
24
+ end
25
+
26
+ it 'should query correct url with `expand` parameter' do
27
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields').and_return(response)
28
+ JIRA::Resource::Createmeta.all(client, :expand => 'projects.issuetypes.fields')
29
+ end
30
+
31
+ it 'should query correct url with `foo` parameter' do
32
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?foo=bar').and_return(response)
33
+ JIRA::Resource::Createmeta.all(client, :foo => 'bar')
34
+ end
35
+
36
+ end
37
+
38
+
39
+ describe 'projectKeys' do
40
+ it 'should query correct url when only one `projectKeys` given as string' do
41
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1').and_return(response)
42
+ JIRA::Resource::Createmeta.all(
43
+ client,
44
+ :projectKeys => 'PROJECT_1',
45
+ )
46
+ end
47
+
48
+ it 'should query correct url when multiple `projectKeys` given as string' do
49
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPROJECT_2').and_return(response)
50
+ JIRA::Resource::Createmeta.all(
51
+ client,
52
+ :projectKeys => ['PROJECT_1', 'PROJECT_2'],
53
+ )
54
+ end
55
+
56
+ it 'should query correct url when only one `projectKeys` given as Project' do
57
+ prj = JIRA::Resource::Project.new(client)
58
+ allow(prj).to receive(:key).and_return('PRJ')
59
+
60
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ').and_return(response)
61
+ JIRA::Resource::Createmeta.all(
62
+ client,
63
+ :projectKeys => prj,
64
+ )
65
+ end
66
+
67
+ it 'should query correct url when multiple `projectKeys` given as Project' do
68
+ prj_1 = JIRA::Resource::Project.new(client)
69
+ allow(prj_1).to receive(:key).and_return('PRJ_1')
70
+ prj_2 = JIRA::Resource::Project.new(client)
71
+ allow(prj_2).to receive(:key).and_return('PRJ_2')
72
+
73
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PRJ_2%2CPRJ_1').and_return(response)
74
+ JIRA::Resource::Createmeta.all(
75
+ client,
76
+ :projectKeys => [prj_2, prj_1],
77
+ )
78
+ end
79
+
80
+ it 'should query correct url when multiple `projectKeys` given as different types' do
81
+ prj_5 = JIRA::Resource::Project.new(client)
82
+ allow(prj_5).to receive(:key).and_return('PRJ_5')
83
+
84
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectKeys=PROJECT_1%2CPRJ_5').and_return(response)
85
+ JIRA::Resource::Createmeta.all(
86
+ client,
87
+ :projectKeys => ['PROJECT_1', prj_5],
88
+ )
89
+ end
90
+ end
91
+
92
+
93
+ describe 'projectIds' do
94
+ it 'should query correct url when only one `projectIds` given as string' do
95
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101').and_return(response)
96
+ JIRA::Resource::Createmeta.all(
97
+ client,
98
+ :projectIds => '10101',
99
+ )
100
+ end
101
+
102
+ it 'should query correct url when multiple `projectIds` given as string' do
103
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C20202').and_return(response)
104
+ JIRA::Resource::Createmeta.all(
105
+ client,
106
+ :projectIds => ['10101', '20202'],
107
+ )
108
+ end
109
+
110
+ it 'should query correct url when only one `projectIds` given as Project' do
111
+ prj = JIRA::Resource::Project.new(client)
112
+ allow(prj).to receive(:id).and_return('30303')
113
+
114
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=30303').and_return(response)
115
+ JIRA::Resource::Createmeta.all(
116
+ client,
117
+ :projectIds => prj,
118
+ )
119
+ end
120
+
121
+ it 'should query correct url when multiple `projectIds` given as Project' do
122
+ prj_1 = JIRA::Resource::Project.new(client)
123
+ allow(prj_1).to receive(:id).and_return('30303')
124
+ prj_2 = JIRA::Resource::Project.new(client)
125
+ allow(prj_2).to receive(:id).and_return('50505')
126
+
127
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=50505%2C30303').and_return(response)
128
+ JIRA::Resource::Createmeta.all(
129
+ client,
130
+ :projectIds => [prj_2, prj_1],
131
+ )
132
+ end
133
+
134
+ it 'should query correct url when multiple `projectIds` given as different types' do
135
+ prj_5 = JIRA::Resource::Project.new(client)
136
+ allow(prj_5).to receive(:id).and_return('60606')
137
+
138
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?projectIds=10101%2C60606').and_return(response)
139
+ JIRA::Resource::Createmeta.all(
140
+ client,
141
+ :projectIds => ['10101', prj_5],
142
+ )
143
+ end
144
+ end
145
+
146
+
147
+ describe 'issuetypeNames' do
148
+ it 'should query correct url when only one `issuetypeNames` given as string' do
149
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature').and_return(response)
150
+ JIRA::Resource::Createmeta.all(
151
+ client,
152
+ :issuetypeNames => 'Feature',
153
+ )
154
+ end
155
+
156
+ it 'should query correct url when multiple `issuetypeNames` given as string' do
157
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CBug').and_return(response)
158
+ JIRA::Resource::Createmeta.all(
159
+ client,
160
+ :issuetypeNames => ['Feature', 'Bug'],
161
+ )
162
+ end
163
+
164
+ it 'should query correct url when only one `issuetypeNames` given as Issuetype' do
165
+ issue_type = JIRA::Resource::Issuetype.new(client)
166
+ allow(issue_type).to receive(:name).and_return('Epic')
167
+
168
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Epic').and_return(response)
169
+ JIRA::Resource::Createmeta.all(
170
+ client,
171
+ :issuetypeNames => issue_type,
172
+ )
173
+ end
174
+
175
+ it 'should query correct url when multiple `issuetypeNames` given as Issuetype' do
176
+ issue_type_1 = JIRA::Resource::Issuetype.new(client)
177
+ allow(issue_type_1).to receive(:name).and_return('Epic')
178
+ issue_type_2 = JIRA::Resource::Issuetype.new(client)
179
+ allow(issue_type_2).to receive(:name).and_return('Sub-Task')
180
+
181
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Sub-Task%2CEpic').and_return(response)
182
+ JIRA::Resource::Createmeta.all(
183
+ client,
184
+ :issuetypeNames => [issue_type_2, issue_type_1],
185
+ )
186
+ end
187
+
188
+ it 'should query correct url when multiple `issuetypeNames` given as different types' do
189
+ issue_type = JIRA::Resource::Issuetype.new(client)
190
+ allow(issue_type).to receive(:name).and_return('Epic')
191
+
192
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeNames=Feature%2CEpic').and_return(response)
193
+ JIRA::Resource::Createmeta.all(
194
+ client,
195
+ :issuetypeNames => ['Feature', issue_type],
196
+ )
197
+ end
198
+ end
199
+
200
+
201
+ describe 'issuetypeIds' do
202
+ it 'should query correct url when only one `issuetypeIds` given as string' do
203
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101').and_return(response)
204
+ JIRA::Resource::Createmeta.all(
205
+ client,
206
+ :issuetypeIds => '10101',
207
+ )
208
+ end
209
+
210
+ it 'should query correct url when multiple `issuetypeIds` given as string' do
211
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C20202').and_return(response)
212
+ JIRA::Resource::Createmeta.all(
213
+ client,
214
+ :issuetypeIds => ['10101', '20202'],
215
+ )
216
+ end
217
+
218
+ it 'should query correct url when only one `issuetypeIds` given as Issuetype' do
219
+ issue_type = JIRA::Resource::Issuetype.new(client)
220
+ allow(issue_type).to receive(:id).and_return('30303')
221
+
222
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=30303').and_return(response)
223
+ JIRA::Resource::Createmeta.all(
224
+ client,
225
+ :issuetypeIds => issue_type,
226
+ )
227
+ end
228
+
229
+ it 'should query correct url when multiple `issuetypeIds` given as Issuetype' do
230
+ issue_type_1 = JIRA::Resource::Issuetype.new(client)
231
+ allow(issue_type_1).to receive(:id).and_return('30303')
232
+ issue_type_2 = JIRA::Resource::Issuetype.new(client)
233
+ allow(issue_type_2).to receive(:id).and_return('50505')
234
+
235
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=50505%2C30303').and_return(response)
236
+ JIRA::Resource::Createmeta.all(
237
+ client,
238
+ :issuetypeIds => [issue_type_2, issue_type_1],
239
+ )
240
+ end
241
+
242
+ it 'should query correct url when multiple `issuetypeIds` given as different types' do
243
+ issue_type = JIRA::Resource::Issuetype.new(client)
244
+ allow(issue_type).to receive(:id).and_return('30303')
245
+
246
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/createmeta?issuetypeIds=10101%2C30303').and_return(response)
247
+ JIRA::Resource::Createmeta.all(
248
+ client,
249
+ :issuetypeIds => ['10101', issue_type],
250
+ )
251
+ end
252
+ end
253
+ end