jira-ruby 1.6.0 → 2.3.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +3 -2
  4. data/README.md +40 -11
  5. data/Rakefile +2 -2
  6. data/example.rb +8 -0
  7. data/jira-ruby.gemspec +1 -2
  8. data/lib/jira/base.rb +1 -1
  9. data/lib/jira/client.rb +85 -12
  10. data/lib/jira/http_client.rb +29 -13
  11. data/lib/jira/http_error.rb +1 -1
  12. data/lib/jira/jwt_client.rb +67 -0
  13. data/lib/jira/oauth_client.rb +18 -6
  14. data/lib/jira/request_client.rb +15 -3
  15. data/lib/jira/resource/attachment.rb +19 -14
  16. data/lib/jira/resource/board.rb +8 -1
  17. data/lib/jira/resource/board_configuration.rb +9 -0
  18. data/lib/jira/resource/issue_picker_suggestions.rb +24 -0
  19. data/lib/jira/resource/issue_picker_suggestions_issue.rb +10 -0
  20. data/lib/jira/resource/sprint.rb +12 -8
  21. data/lib/jira/resource/suggested_issue.rb +9 -0
  22. data/lib/jira/resource/user.rb +1 -1
  23. data/lib/jira/resource/watcher.rb +7 -0
  24. data/lib/jira/version.rb +1 -1
  25. data/lib/jira-ruby.rb +6 -0
  26. data/spec/integration/user_spec.rb +3 -3
  27. data/spec/integration/watcher_spec.rb +15 -6
  28. data/spec/jira/base_spec.rb +12 -0
  29. data/spec/jira/client_spec.rb +70 -0
  30. data/spec/jira/http_client_spec.rb +137 -8
  31. data/spec/jira/jwt_uri_builder_spec.rb +59 -0
  32. data/spec/jira/oauth_client_spec.rb +47 -10
  33. data/spec/jira/request_client_spec.rb +37 -10
  34. data/spec/jira/resource/attachment_spec.rb +79 -22
  35. data/spec/jira/resource/board_spec.rb +50 -1
  36. data/spec/jira/resource/issue_picker_suggestions_spec.rb +79 -0
  37. data/spec/jira/resource/issue_spec.rb +1 -1
  38. data/spec/jira/resource/jira_picker_suggestions_issue_spec.rb +18 -0
  39. data/spec/jira/resource/sprint_spec.rb +23 -11
  40. metadata +32 -8
@@ -35,6 +35,26 @@ describe JIRA::OauthClient do
35
35
  expect(oauth_client.get_request_token).to eq(request_token)
36
36
  end
37
37
 
38
+ it 'could pre-process the response body in a block' do
39
+ response = Net::HTTPSuccess.new(1.0, '200', 'OK')
40
+ allow_any_instance_of(OAuth::Consumer).to receive(:request).and_return(response)
41
+ allow(response).to receive(:body).and_return('&oauth_token=token&oauth_token_secret=secret&password=top_secret')
42
+
43
+ result = oauth_client.request_token do |response_body|
44
+ CGI.parse(response_body).each_with_object({}) do |(k, v), h|
45
+ next if k == 'password'
46
+
47
+ h[k.strip.to_sym] = v.first
48
+ end
49
+ end
50
+
51
+ expect(result).to be_an_instance_of(OAuth::RequestToken)
52
+ expect(result.consumer).to eql(oauth_client.consumer)
53
+ expect(result.params[:oauth_token]).to eql('token')
54
+ expect(result.params[:oauth_token_secret]).to eql('secret')
55
+ expect(result.params[:password]).to be_falsey
56
+ end
57
+
38
58
  it 'allows setting the request token' do
39
59
  token = double
40
60
  expect(OAuth::RequestToken).to receive(:new).with(oauth_client.consumer, 'foo', 'bar').and_return(token)
@@ -58,7 +78,7 @@ describe JIRA::OauthClient do
58
78
  request_token = OAuth::RequestToken.new(oauth_client.consumer)
59
79
  allow(oauth_client).to receive(:get_request_token).and_return(request_token)
60
80
  mock_access_token = double
61
- expect(request_token).to receive(:get_access_token).with(oauth_verifier: 'abc123').and_return(mock_access_token)
81
+ expect(request_token).to receive(:get_access_token).with({ oauth_verifier: 'abc123' }).and_return(mock_access_token)
62
82
  oauth_client.init_access_token(oauth_verifier: 'abc123')
63
83
  expect(oauth_client.access_token).to eq(mock_access_token)
64
84
  end
@@ -82,28 +102,45 @@ describe JIRA::OauthClient do
82
102
  end
83
103
 
84
104
  describe 'http' do
105
+ let(:headers) { double }
106
+ let(:access_token) { double }
107
+ let(:body) { nil }
108
+
109
+ before do
110
+ allow(oauth_client).to receive(:access_token).and_return(access_token)
111
+ end
112
+
85
113
  it 'responds to the http methods' do
86
- headers = double
87
- mock_access_token = double
88
- allow(oauth_client).to receive(:access_token).and_return(mock_access_token)
89
114
  %i[delete get head].each do |method|
90
- expect(mock_access_token).to receive(method).with('/path', headers).and_return(response)
115
+ expect(access_token).to receive(method).with('/path', headers).and_return(response)
91
116
  oauth_client.make_request(method, '/path', '', headers)
92
117
  end
93
118
  %i[post put].each do |method|
94
- expect(mock_access_token).to receive(method).with('/path', '', headers).and_return(response)
119
+ expect(access_token).to receive(method).with('/path', '', headers).and_return(response)
95
120
  oauth_client.make_request(method, '/path', '', headers)
96
121
  end
97
122
  end
98
123
 
99
124
  it 'performs a request' do
100
- body = nil
101
- headers = double
102
- access_token = double
103
125
  expect(access_token).to receive(:send).with(:get, '/foo', headers).and_return(response)
104
- allow(oauth_client).to receive(:access_token).and_return(access_token)
126
+
127
+
105
128
  oauth_client.request(:get, '/foo', body, headers)
106
129
  end
130
+
131
+ context 'for a multipart request' do
132
+ subject { oauth_client.make_multipart_request('/path', data, headers) }
133
+
134
+ let(:data) { {} }
135
+ let(:headers) { {} }
136
+
137
+ it 'signs the access_token and performs the request' do
138
+ expect(access_token).to receive(:sign!).with(an_instance_of(Net::HTTP::Post::Multipart))
139
+ expect(oauth_client.consumer).to receive_message_chain(:http, :request).with(an_instance_of(Net::HTTP::Post::Multipart))
140
+
141
+ subject
142
+ end
143
+ end
107
144
  end
108
145
 
109
146
  describe 'auth type is oauth_2legged' do
@@ -1,14 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe JIRA::RequestClient do
4
- it 'raises an exception for non success responses' do
5
- response = double
6
- allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(false)
7
- rc = JIRA::RequestClient.new
8
- expect(rc).to receive(:make_request).with(:get, '/foo', '', {}).and_return(response)
9
-
10
- expect do
11
- rc.request(:get, '/foo', '', {})
12
- end.to raise_exception(JIRA::HTTPError)
4
+ let(:request_client) { JIRA::RequestClient.new }
5
+
6
+ describe '#request' do
7
+ subject(:request) { request_client.request(:get, '/foo', '', {}) }
8
+
9
+ context 'when doing a request fails' do
10
+ let(:response) { double }
11
+
12
+ before do
13
+ allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(false)
14
+ allow(request_client).to receive(:make_request).with(:get, '/foo', '', {}).and_return(response)
15
+ end
16
+
17
+ it 'raises an exception' do
18
+ expect{ subject }.to raise_exception(JIRA::HTTPError)
19
+ end
20
+ end
21
+ end
22
+
23
+ describe '#request_multipart' do
24
+ subject(:request) { request_client.request_multipart('/foo', data, {}) }
25
+
26
+ let(:data) { double }
27
+
28
+ context 'when doing a request fails' do
29
+ let(:response) { double }
30
+
31
+ before do
32
+ allow(response).to receive(:kind_of?).with(Net::HTTPSuccess).and_return(false)
33
+ allow(request_client).to receive(:make_multipart_request).with('/foo', data, {}).and_return(response)
34
+ end
35
+
36
+ it 'raises an exception' do
37
+ expect{ subject }.to raise_exception(JIRA::HTTPError)
38
+ end
39
+ end
13
40
  end
14
- end
41
+ end
@@ -1,6 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe JIRA::Resource::Attachment do
4
+ subject(:attachment) do
5
+ JIRA::Resource::Attachment.new(
6
+ client,
7
+ issue: JIRA::Resource::Issue.new(client),
8
+ attrs: { 'author' => { 'foo' => 'bar' } }
9
+ )
10
+ end
11
+
4
12
  let(:client) do
5
13
  double(
6
14
  'client',
@@ -17,42 +25,78 @@ describe JIRA::Resource::Attachment do
17
25
  end
18
26
 
19
27
  describe 'relationships' do
20
- subject do
21
- JIRA::Resource::Attachment.new(client,
22
- issue: JIRA::Resource::Issue.new(client),
23
- attrs: { 'author' => { 'foo' => 'bar' } })
28
+ it 'has an author' do
29
+ expect(subject).to have_one(:author, JIRA::Resource::User)
24
30
  end
25
31
 
26
- it 'has the correct relationships' do
27
- expect(subject).to have_one(:author, JIRA::Resource::User)
32
+ it 'has the correct author name' do
28
33
  expect(subject.author.foo).to eq('bar')
29
34
  end
30
35
  end
31
36
 
32
- describe '#meta' do
37
+ describe '.meta' do
38
+ subject { JIRA::Resource::Attachment.meta(client) }
39
+
33
40
  let(:response) do
34
41
  double(
35
- 'response',
36
- body: '{"enabled":true,"uploadLimit":10485760}'
42
+ 'response',
43
+ body: '{"enabled":true,"uploadLimit":10485760}'
37
44
  )
38
45
  end
39
46
 
40
47
  it 'returns meta information about attachment upload' do
41
48
  expect(client).to receive(:get).with('/jira/rest/api/2/attachment/meta').and_return(response)
42
- JIRA::Resource::Attachment.meta(client)
49
+
50
+ subject
43
51
  end
44
52
 
45
- subject { JIRA::Resource::AttachmentFactory.new(client) }
53
+ context 'the factory delegates correctly' do
54
+ subject { JIRA::Resource::AttachmentFactory.new(client) }
46
55
 
47
- it 'delegates #meta to to target class' do
48
- expect(subject).to respond_to(:meta)
56
+ it 'delegates #meta to to target class' do
57
+ expect(subject).to respond_to(:meta)
58
+ end
49
59
  end
50
60
  end
51
61
 
52
- describe '#save!' do
62
+ describe '#save' do
63
+ subject { attachment.save('file' => path_to_file) }
64
+ let(:path_to_file) { './spec/mock_responses/issue.json' }
65
+ let(:response) do
66
+ double(
67
+ body: [
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
77
+ )
78
+ end
79
+ let(:issue) { JIRA::Resource::Issue.new(client) }
80
+
81
+ before do
82
+ allow(client).to receive(:post_multipart).and_return(response)
83
+ end
84
+
53
85
  it 'successfully update the attachment' do
54
- basic_auth_http_conn = double
55
- response = double(
86
+ subject
87
+
88
+ expect(attachment.filename).to eq 'picture.jpg'
89
+ expect(attachment.mimeType).to eq 'image/jpeg'
90
+ expect(attachment.size).to eq 23_123
91
+ end
92
+ end
93
+
94
+ describe '#save!' do
95
+ subject { attachment.save!('file' => path_to_file) }
96
+
97
+ let(:path_to_file) { './spec/mock_responses/issue.json' }
98
+ let(:response) do
99
+ double(
56
100
  body: [
57
101
  {
58
102
  "id": 10_001,
@@ -64,18 +108,31 @@ describe JIRA::Resource::Attachment do
64
108
  }
65
109
  ].to_json
66
110
  )
111
+ end
112
+ let(:issue) { JIRA::Resource::Issue.new(client) }
67
113
 
68
- allow(client.request_client).to receive(:basic_auth_http_conn).and_return(basic_auth_http_conn)
69
- allow(basic_auth_http_conn).to receive(:request).and_return(response)
114
+ before do
115
+ allow(client).to receive(:post_multipart).and_return(response)
116
+ end
70
117
 
71
- issue = JIRA::Resource::Issue.new(client)
72
- path_to_file = './spec/mock_responses/issue.json'
73
- attachment = JIRA::Resource::Attachment.new(client, issue: issue)
74
- attachment.save!('file' => path_to_file)
118
+ it 'successfully update the attachment' do
119
+ subject
75
120
 
76
121
  expect(attachment.filename).to eq 'picture.jpg'
77
122
  expect(attachment.mimeType).to eq 'image/jpeg'
78
123
  expect(attachment.size).to eq 23_123
79
124
  end
125
+
126
+ context 'when passing in a symbol as file key' do
127
+ subject { attachment.save!(file: path_to_file) }
128
+
129
+ it 'successfully update the attachment' do
130
+ subject
131
+
132
+ expect(attachment.filename).to eq 'picture.jpg'
133
+ expect(attachment.mimeType).to eq 'image/jpeg'
134
+ expect(attachment.size).to eq 23_123
135
+ end
136
+ end
80
137
  end
81
138
  end
@@ -89,7 +89,7 @@ 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)
92
- expect(client).to receive(:get).with('/rest/agile/1.0/board/84/issue?')
92
+ expect(client).to receive(:get).with('/rest/agile/1.0/board/84/issue')
93
93
  .and_return(issues_response)
94
94
  expect(client).to receive(:Issue).and_return(JIRA::Resource::IssueFactory.new(client))
95
95
 
@@ -172,4 +172,53 @@ eos
172
172
  expect(client).to receive(:Sprint).twice.and_return(JIRA::Resource::SprintFactory.new(client))
173
173
  expect(board.sprints.size).to be(2)
174
174
  end
175
+
176
+ it 'should get board configuration for a board' do
177
+ response = double
178
+
179
+ api_json = <<-eos
180
+ {
181
+ "id":1,
182
+ "name":"My Board",
183
+ "type":"kanban",
184
+ "self":"https://mycompany.atlassian.net/rest/agile/1.0/board/1/configuration",
185
+ "location":{
186
+ "type":"project",
187
+ "key":"MYPROJ",
188
+ "id":"10000",
189
+ "self":"https://mycompany.atlassian.net/rest/api/2/project/10000",
190
+ "name":"My Project"
191
+ },
192
+ "filter":{
193
+ "id":"10000",
194
+ "self":"https://mycompany.atlassian.net/rest/api/2/filter/10000"
195
+ },
196
+ "subQuery":{
197
+ "query":"resolution = EMPTY OR resolution != EMPTY AND resolutiondate >= -5d"
198
+ },
199
+ "columnConfig":{
200
+ "columns":[
201
+ {
202
+ "name":"Backlog",
203
+ "statuses":[
204
+ {
205
+ "id":"10000",
206
+ "self":"https://mycompany.atlassian.net/rest/api/2/status/10000"
207
+ }
208
+ ]
209
+ }
210
+ ],
211
+ "constraintType":"issueCount"
212
+ },
213
+ "ranking":{
214
+ "rankCustomFieldId":10011
215
+ }
216
+ }
217
+ eos
218
+ allow(response).to receive(:body).and_return(api_json)
219
+ allow(board).to receive(:id).and_return(84)
220
+ expect(client).to receive(:get).with('/rest/agile/1.0/board/84/configuration').and_return(response)
221
+ expect(client).to receive(:BoardConfiguration).and_return(JIRA::Resource::BoardConfigurationFactory.new(client))
222
+ expect(board.configuration).not_to be(nil)
223
+ end
175
224
  end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::IssuePickerSuggestions do
4
+ let(:client) do
5
+ double('client', options: {
6
+ rest_base_path: '/jira/rest/api/2'
7
+ })
8
+ end
9
+
10
+ describe 'relationships' do
11
+ subject do
12
+ JIRA::Resource::IssuePickerSuggestions.new(client, attrs: {
13
+ 'sections' => [{ 'id' => 'hs'}, { 'id' => 'cs' }]
14
+ })
15
+ end
16
+
17
+ it 'has the correct relationships' do
18
+ expect(subject).to have_many(:sections, JIRA::Resource::IssuePickerSuggestionsIssue)
19
+ expect(subject.sections.length).to eq(2)
20
+ end
21
+ end
22
+
23
+ describe '#all' do
24
+ let(:response) { double }
25
+ let(:issue_picker_suggestions) { double }
26
+
27
+ before do
28
+ allow(response).to receive(:body).and_return('{"sections":[{"id": "cs"}]}')
29
+ allow(client).to receive(:IssuePickerSuggestions).and_return(issue_picker_suggestions)
30
+ allow(issue_picker_suggestions).to receive(:build)
31
+ end
32
+
33
+ it 'should autocomplete issues' do
34
+ allow(response).to receive(:body).and_return('{"sections":[{"id": "cs"}]}')
35
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query')
36
+ .and_return(response)
37
+
38
+ expect(client).to receive(:IssuePickerSuggestions).and_return(issue_picker_suggestions)
39
+ expect(issue_picker_suggestions).to receive(:build).with({ 'sections' => [{ 'id' => 'cs' }] })
40
+
41
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query')
42
+ end
43
+
44
+ it 'should autocomplete issues with current jql' do
45
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentJQL=project+%3D+PR')
46
+ .and_return(response)
47
+
48
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_jql: 'project = PR')
49
+ end
50
+
51
+ it 'should autocomplete issues with current issue jey' do
52
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentIssueKey=PR-42')
53
+ .and_return(response)
54
+
55
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_issue_key: 'PR-42')
56
+ end
57
+
58
+ it 'should autocomplete issues with current project id' do
59
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&currentProjectId=PR')
60
+ .and_return(response)
61
+
62
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', current_project_id: 'PR')
63
+ end
64
+
65
+ it 'should autocomplete issues with show sub tasks' do
66
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&showSubTasks=true')
67
+ .and_return(response)
68
+
69
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', show_sub_tasks: true)
70
+ end
71
+
72
+ it 'should autocomplete issues with show sub tasks parent' do
73
+ expect(client).to receive(:get).with('/jira/rest/api/2/issue/picker?query=query&showSubTaskParent=true')
74
+ .and_return(response)
75
+
76
+ JIRA::Resource::IssuePickerSuggestions.all(client, 'query', show_sub_task_parent: true)
77
+ end
78
+ end
79
+ end
@@ -47,7 +47,7 @@ describe JIRA::Resource::Issue do
47
47
  .and_return(empty_response)
48
48
 
49
49
  expect(client).to receive(:Issue).and_return(issue)
50
- expect(issue).to receive(:build).with('id' => '1', 'summary' => 'Bugs Everywhere')
50
+ expect(issue).to receive(:build).with({ 'id' => '1', 'summary' => 'Bugs Everywhere' })
51
51
 
52
52
  issues = JIRA::Resource::Issue.all(client)
53
53
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe JIRA::Resource::IssuePickerSuggestionsIssue do
4
+ let(:client) { double('client') }
5
+
6
+ describe 'relationships' do
7
+ subject do
8
+ JIRA::Resource::IssuePickerSuggestionsIssue.new(client, attrs: {
9
+ 'issues' => [{ 'id' => '1'}, { 'id' => '2' }]
10
+ })
11
+ end
12
+
13
+ it 'has the correct relationships' do
14
+ expect(subject).to have_many(:issues, JIRA::Resource::SuggestedIssue)
15
+ expect(subject.issues.length).to eq(2)
16
+ end
17
+ end
18
+ end
@@ -1,12 +1,25 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe JIRA::Resource::Sprint do
4
- describe 'peristence' do
5
- let(:sprint) { described_class.new(client) }
6
- let(:client) { double('Client', options: { site: 'https://foo.bar.com' }) }
4
+ let(:client) do
5
+ client = double(options: { site: 'https://foo.bar.com', context_path: '/jira' })
6
+ allow(client).to receive(:Sprint).and_return(JIRA::Resource::SprintFactory.new(client))
7
+ client
8
+ end
9
+ let(:sprint) { described_class.new(client) }
10
+ let(:agile_sprint_path) { "#{sprint.client.options[:context_path]}/rest/agile/1.0/sprint/#{sprint.id}" }
7
11
 
12
+ describe '::find' do
13
+ let(:response) { double('Response', body: '{"some_detail":"some detail"}') }
14
+
15
+ it 'fetches the sprint from JIRA' do
16
+ expect(client).to receive(:get).with('/jira/rest/agile/1.0/sprint/111').and_return(response)
17
+ expect(JIRA::Resource::Sprint.find(client, '111')).to be_a(JIRA::Resource::Sprint)
18
+ end
19
+ end
20
+
21
+ describe 'peristence' do
8
22
  describe '#save' do
9
- let(:agile_sprint_url) { "#{sprint.client.options[:site]}/rest/agile/1.0/sprint/#{sprint.id}" }
10
23
  let(:instance_attrs) { { start_date: '2016-06-01' } }
11
24
 
12
25
  before do
@@ -17,7 +30,7 @@ describe JIRA::Resource::Sprint do
17
30
  let(:given_attrs) { { start_date: '2016-06-10' } }
18
31
 
19
32
  it 'calls save on the super class with the given attributes & agile url' do
20
- expect_any_instance_of(JIRA::Base).to receive(:save).with(given_attrs, agile_sprint_url)
33
+ expect_any_instance_of(JIRA::Base).to receive(:save).with(given_attrs, agile_sprint_path)
21
34
 
22
35
  sprint.save(given_attrs)
23
36
  end
@@ -25,7 +38,7 @@ describe JIRA::Resource::Sprint do
25
38
 
26
39
  context 'when attributes are not specified' do
27
40
  it 'calls save on the super class with the instance attributes & agile url' do
28
- expect_any_instance_of(JIRA::Base).to receive(:save).with(instance_attrs, agile_sprint_url)
41
+ expect_any_instance_of(JIRA::Base).to receive(:save).with(instance_attrs, agile_sprint_path)
29
42
 
30
43
  sprint.save
31
44
  end
@@ -33,7 +46,7 @@ describe JIRA::Resource::Sprint do
33
46
 
34
47
  context 'when providing the path argument' do
35
48
  it 'ignores it' do
36
- expect_any_instance_of(JIRA::Base).to receive(:save).with(instance_attrs, agile_sprint_url)
49
+ expect_any_instance_of(JIRA::Base).to receive(:save).with(instance_attrs, agile_sprint_path)
37
50
 
38
51
  sprint.save({}, 'mavenlink.com')
39
52
  end
@@ -41,7 +54,6 @@ describe JIRA::Resource::Sprint do
41
54
  end
42
55
 
43
56
  describe '#save!' do
44
- let(:agile_sprint_url) { "#{sprint.client.options[:site]}/rest/agile/1.0/sprint/#{sprint.id}" }
45
57
  let(:instance_attrs) { { start_date: '2016-06-01' } }
46
58
 
47
59
  before do
@@ -52,7 +64,7 @@ describe JIRA::Resource::Sprint do
52
64
  let(:given_attrs) { { start_date: '2016-06-10' } }
53
65
 
54
66
  it 'calls save! on the super class with the given attributes & agile url' do
55
- expect_any_instance_of(JIRA::Base).to receive(:save!).with(given_attrs, agile_sprint_url)
67
+ expect_any_instance_of(JIRA::Base).to receive(:save!).with(given_attrs, agile_sprint_path)
56
68
 
57
69
  sprint.save!(given_attrs)
58
70
  end
@@ -60,7 +72,7 @@ describe JIRA::Resource::Sprint do
60
72
 
61
73
  context 'when attributes are not specified' do
62
74
  it 'calls save! on the super class with the instance attributes & agile url' do
63
- expect_any_instance_of(JIRA::Base).to receive(:save!).with(instance_attrs, agile_sprint_url)
75
+ expect_any_instance_of(JIRA::Base).to receive(:save!).with(instance_attrs, agile_sprint_path)
64
76
 
65
77
  sprint.save!
66
78
  end
@@ -68,7 +80,7 @@ describe JIRA::Resource::Sprint do
68
80
 
69
81
  context 'when providing the path argument' do
70
82
  it 'ignores it' do
71
- expect_any_instance_of(JIRA::Base).to receive(:save!).with(instance_attrs, agile_sprint_url)
83
+ expect_any_instance_of(JIRA::Base).to receive(:save!).with(instance_attrs, agile_sprint_path)
72
84
 
73
85
  sprint.save!({}, 'mavenlink.com')
74
86
  end