tracker_api 1.7.1 → 1.11.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/README.md +16 -0
  4. data/lib/tracker_api.rb +19 -0
  5. data/lib/tracker_api/client.rb +16 -35
  6. data/lib/tracker_api/endpoints/attachment.rb +38 -0
  7. data/lib/tracker_api/endpoints/attachments.rb +22 -0
  8. data/lib/tracker_api/endpoints/blockers.rb +20 -0
  9. data/lib/tracker_api/endpoints/comment.rb +9 -2
  10. data/lib/tracker_api/endpoints/iteration.rb +35 -0
  11. data/lib/tracker_api/endpoints/release.rb +17 -0
  12. data/lib/tracker_api/endpoints/releases.rb +20 -0
  13. data/lib/tracker_api/endpoints/reviews.rb +21 -0
  14. data/lib/tracker_api/endpoints/search.rb +1 -1
  15. data/lib/tracker_api/endpoints/stories.rb +10 -0
  16. data/lib/tracker_api/error.rb +12 -2
  17. data/lib/tracker_api/file_utility.rb +16 -0
  18. data/lib/tracker_api/resources/activity.rb +1 -1
  19. data/lib/tracker_api/resources/blocker.rb +18 -0
  20. data/lib/tracker_api/resources/comment.rb +35 -0
  21. data/lib/tracker_api/resources/cycle_time_details.rb +21 -0
  22. data/lib/tracker_api/resources/daily_history_container.rb +13 -0
  23. data/lib/tracker_api/resources/epic.rb +9 -0
  24. data/lib/tracker_api/resources/file_attachment.rb +37 -0
  25. data/lib/tracker_api/resources/iteration.rb +14 -0
  26. data/lib/tracker_api/resources/project.rb +13 -0
  27. data/lib/tracker_api/resources/release.rb +29 -0
  28. data/lib/tracker_api/resources/review.rb +19 -0
  29. data/lib/tracker_api/resources/review_type.rb +15 -0
  30. data/lib/tracker_api/resources/story.rb +49 -6
  31. data/lib/tracker_api/version.rb +1 -1
  32. data/lib/virtus/attribute/nullify_blank.rb +1 -1
  33. data/test/client_test.rb +52 -52
  34. data/test/comment_test.rb +46 -4
  35. data/test/error_test.rb +47 -0
  36. data/test/file_attachment_test.rb +19 -0
  37. data/test/iteration_test.rb +31 -0
  38. data/test/minitest_helper.rb +5 -2
  39. data/test/project_test.rb +59 -47
  40. data/test/release_test.rb +22 -0
  41. data/test/story_test.rb +65 -52
  42. data/test/task_test.rb +3 -3
  43. data/test/vcr/cassettes/create_attachments.json +1 -0
  44. data/test/vcr/cassettes/create_comment.json +1 -1
  45. data/test/vcr/cassettes/create_comment_with_attachment.json +1 -0
  46. data/test/vcr/cassettes/create_story_comment.json +1 -1
  47. data/test/vcr/cassettes/delete_an_attachment.json +1 -0
  48. data/test/vcr/cassettes/delete_attachments.json +1 -0
  49. data/test/vcr/cassettes/delete_comment.json +1 -0
  50. data/test/vcr/cassettes/delete_comments.json +1 -0
  51. data/test/vcr/cassettes/get_current_iteration.json +1 -1
  52. data/test/vcr/cassettes/get_cycle_time_details.json +1 -0
  53. data/test/vcr/cassettes/get_daily_history_container.json +1 -0
  54. data/test/vcr/cassettes/get_releases.json +1 -0
  55. data/test/vcr/cassettes/get_story_in_epic.json +1 -1
  56. data/test/vcr/cassettes/get_story_reviews.json +1 -0
  57. data/test/vcr/cassettes/release_stories.json +1 -0
  58. data/test/vcr/cassettes/search_project.json +1 -1
  59. data/test/workspace_test.rb +5 -5
  60. data/tracker_api.gemspec +3 -2
  61. metadata +68 -9
@@ -1,3 +1,3 @@
1
1
  module TrackerApi
2
- VERSION = '1.7.1'
2
+ VERSION = '1.11.0'
3
3
  end
@@ -14,7 +14,7 @@ module Virtus
14
14
  if !value_coerced?(output) && input.blank?
15
15
  nil
16
16
  # Added to nullify anything that is blank not just strings.
17
- elsif output.blank?
17
+ elsif output.blank? && output != false
18
18
  nil
19
19
  else
20
20
  output
@@ -2,7 +2,7 @@ require_relative 'minitest_helper'
2
2
 
3
3
  describe TrackerApi do
4
4
  it 'has a version' do
5
- ::TrackerApi::VERSION.wont_be_nil
5
+ _(::TrackerApi::VERSION).wont_be_nil
6
6
  end
7
7
  end
8
8
 
@@ -13,10 +13,10 @@ describe TrackerApi::Client do
13
13
  token: '12345',
14
14
  logger: LOGGER)
15
15
 
16
- client.url.must_equal 'http://test.com'
17
- client.api_version.must_equal '/foo-bar/1'
18
- client.token.must_equal '12345'
19
- client.logger.must_equal LOGGER
16
+ _(client.url).must_equal 'http://test.com'
17
+ _(client.api_version).must_equal '/foo-bar/1'
18
+ _(client.token).must_equal '12345'
19
+ _(client.logger).must_equal LOGGER
20
20
  end
21
21
 
22
22
  describe '.projects' do
@@ -27,18 +27,18 @@ describe TrackerApi::Client do
27
27
  VCR.use_cassette('get all projects', record: :new_episodes) do
28
28
  projects = client.projects(fields: ':default,account,current_velocity,labels(name),epics(:default,label(name))')
29
29
 
30
- projects.wont_be_empty
30
+ _(projects).wont_be_empty
31
31
  project = projects.first
32
- project.must_be_instance_of TrackerApi::Resources::Project
33
- project.id.must_equal pt_user[:project_id]
32
+ _(project).must_be_instance_of TrackerApi::Resources::Project
33
+ _(project.id).must_equal pt_user[:project_id]
34
34
 
35
- project.account.must_be_instance_of TrackerApi::Resources::Account
35
+ _(project.account).must_be_instance_of TrackerApi::Resources::Account
36
36
 
37
- project.labels.wont_be_empty
38
- project.labels.first.must_be_instance_of TrackerApi::Resources::Label
37
+ _(project.labels).wont_be_empty
38
+ _(project.labels.first).must_be_instance_of TrackerApi::Resources::Label
39
39
 
40
- project.epics.wont_be_empty
41
- project.epics.first.must_be_instance_of TrackerApi::Resources::Epic
40
+ _(project.epics).wont_be_empty
41
+ _(project.epics.first).must_be_instance_of TrackerApi::Resources::Epic
42
42
  end
43
43
  end
44
44
  end
@@ -52,11 +52,11 @@ describe TrackerApi::Client do
52
52
  VCR.use_cassette('get project', record: :new_episodes) do
53
53
  project = client.project(project_id)
54
54
 
55
- project.must_be_instance_of TrackerApi::Resources::Project
56
- project.id.must_equal project_id
55
+ _(project).must_be_instance_of TrackerApi::Resources::Project
56
+ _(project.id).must_equal project_id
57
57
 
58
- project.account.must_be_nil
59
- project.account_id.wont_be_nil
58
+ _(project.account).must_be_nil
59
+ _(project.account_id).wont_be_nil
60
60
  end
61
61
  end
62
62
  end
@@ -69,9 +69,9 @@ describe TrackerApi::Client do
69
69
  VCR.use_cassette('get workspace', record: :new_episodes) do
70
70
  workspace = client.workspace(pt_user[:workspace_id])
71
71
 
72
- workspace.must_be_instance_of TrackerApi::Resources::Workspace
73
- workspace.id.must_equal pt_user[:workspace_id]
74
- workspace.name.wont_be_empty
72
+ _(workspace).must_be_instance_of TrackerApi::Resources::Workspace
73
+ _(workspace.id).must_equal pt_user[:workspace_id]
74
+ _(workspace.name).wont_be_empty
75
75
  end
76
76
  end
77
77
  end
@@ -85,10 +85,10 @@ describe TrackerApi::Client do
85
85
  VCR.use_cassette('get all workspaces', record: :new_episodes) do
86
86
  workspaces = client.workspaces(fields: ':default,projects(id,name)')
87
87
 
88
- workspaces.wont_be_empty
88
+ _(workspaces).wont_be_empty
89
89
  workspace = workspaces.first
90
- workspace.must_be_instance_of TrackerApi::Resources::Workspace
91
- workspace.id.must_equal pt_user[:workspace_id]
90
+ _(workspace).must_be_instance_of TrackerApi::Resources::Workspace
91
+ _(workspace.id).must_equal pt_user[:workspace_id]
92
92
  end
93
93
  end
94
94
  end
@@ -105,10 +105,10 @@ describe TrackerApi::Client do
105
105
  VCR.use_cassette('get me', record: :new_episodes) do
106
106
  me = client.me
107
107
 
108
- me.must_be_instance_of TrackerApi::Resources::Me
109
- me.username.must_equal username
108
+ _(me).must_be_instance_of TrackerApi::Resources::Me
109
+ _(me.username).must_equal username
110
110
 
111
- me.projects.map(&:project_id).must_include project_id
111
+ _(me.projects.map(&:project_id)).must_include project_id
112
112
  end
113
113
  end
114
114
  end
@@ -124,14 +124,14 @@ describe TrackerApi::Client do
124
124
 
125
125
  # skip pagination with a hugh limit
126
126
  unpaged_stories = project.stories(limit: 300)
127
- unpaged_stories.wont_be_empty
128
- unpaged_stories.length.must_be :>, 7
127
+ _(unpaged_stories).wont_be_empty
128
+ _(unpaged_stories.length).must_be :>, 7
129
129
 
130
130
  # force pagination with a small limit
131
131
  paged_stories = project.stories(limit: 7)
132
- paged_stories.wont_be_empty
133
- paged_stories.length.must_equal unpaged_stories.length
134
- paged_stories.map(&:id).sort.uniq.must_equal unpaged_stories.map(&:id).sort.uniq
132
+ _(paged_stories).wont_be_empty
133
+ _(paged_stories.length).must_equal unpaged_stories.length
134
+ _(paged_stories.map(&:id).sort.uniq).must_equal unpaged_stories.map(&:id).sort.uniq
135
135
  end
136
136
  end
137
137
 
@@ -141,8 +141,8 @@ describe TrackerApi::Client do
141
141
 
142
142
  # force no pagination
143
143
  stories = project.stories(limit: 7, auto_paginate: false)
144
- stories.wont_be_empty
145
- stories.length.must_equal 7
144
+ _(stories).wont_be_empty
145
+ _(stories.length).must_equal 7
146
146
  end
147
147
  end
148
148
 
@@ -152,8 +152,8 @@ describe TrackerApi::Client do
152
152
 
153
153
  done_iterations = project.iterations(scope: :done, offset: -12, limit: 5)
154
154
 
155
- done_iterations.wont_be_empty
156
- done_iterations.length.must_be :<=, 12
155
+ _(done_iterations).wont_be_empty
156
+ _(done_iterations.length).must_be :<=, 12
157
157
  end
158
158
  end
159
159
  end
@@ -166,8 +166,8 @@ describe TrackerApi::Client do
166
166
  VCR.use_cassette('client: get single story by story id', record: :new_episodes) do
167
167
  story = client.story('66728004', fields: ':default,owned_by')
168
168
 
169
- story.must_be_instance_of TrackerApi::Resources::Story
170
- story.owned_by.wont_be_nil
169
+ _(story).must_be_instance_of TrackerApi::Resources::Story
170
+ _(story.owned_by).wont_be_nil
171
171
  end
172
172
  end
173
173
  end
@@ -180,8 +180,8 @@ describe TrackerApi::Client do
180
180
  VCR.use_cassette('client: get single epic by epic id', record: :new_episodes) do
181
181
  epic = client.epic('1087314', fields: ':default,label_id')
182
182
 
183
- epic.must_be_instance_of TrackerApi::Resources::Epic
184
- epic.label_id.wont_be_nil
183
+ _(epic).must_be_instance_of TrackerApi::Resources::Epic
184
+ _(epic.label_id).wont_be_nil
185
185
  end
186
186
  end
187
187
  end
@@ -194,13 +194,13 @@ describe TrackerApi::Client do
194
194
  VCR.use_cassette('get all notifications', record: :new_episodes) do
195
195
  notifications = client.notifications
196
196
 
197
- notifications.wont_be_empty
197
+ _(notifications).wont_be_empty
198
198
  notification = notifications.first
199
- notification.must_be_instance_of TrackerApi::Resources::Notification
199
+ _(notification).must_be_instance_of TrackerApi::Resources::Notification
200
200
 
201
- notification.project.id.must_equal pt_user[:project_id]
202
- notification.story.must_be_instance_of TrackerApi::Resources::Story
203
- notification.performer.must_be_instance_of TrackerApi::Resources::Person
201
+ _(notification.project.id).must_equal pt_user[:project_id]
202
+ _(notification.story).must_be_instance_of TrackerApi::Resources::Story
203
+ _(notification.performer).must_be_instance_of TrackerApi::Resources::Person
204
204
  end
205
205
  end
206
206
  end
@@ -213,19 +213,19 @@ describe TrackerApi::Client do
213
213
  VCR.use_cassette('get my activities', record: :new_episodes) do
214
214
  activities = client.activity(fields: ':default')
215
215
 
216
- activities.wont_be_empty
216
+ _(activities).wont_be_empty
217
217
  activity = activities.first
218
- activity.must_be_instance_of TrackerApi::Resources::Activity
218
+ _(activity).must_be_instance_of TrackerApi::Resources::Activity
219
219
 
220
- activity.changes.wont_be_empty
221
- activity.changes.first.must_be_instance_of TrackerApi::Resources::Change
220
+ _(activity.changes).wont_be_empty
221
+ _(activity.changes.first).must_be_instance_of TrackerApi::Resources::Change
222
222
 
223
- activity.primary_resources.wont_be_empty
224
- activity.primary_resources.first.must_be_instance_of TrackerApi::Resources::PrimaryResource
223
+ _(activity.primary_resources).wont_be_empty
224
+ _(activity.primary_resources.first).must_be_instance_of TrackerApi::Resources::PrimaryResource
225
225
 
226
- activity.project.must_be_instance_of TrackerApi::Resources::Project
226
+ _(activity.project).must_be_instance_of TrackerApi::Resources::Project
227
227
 
228
- activity.performed_by.must_be_instance_of TrackerApi::Resources::Person
228
+ _(activity.performed_by).must_be_instance_of TrackerApi::Resources::Person
229
229
  end
230
230
  end
231
231
  end
@@ -17,8 +17,20 @@ describe TrackerApi::Resources::Comment do
17
17
  comment = story.create_comment(text: text)
18
18
  end
19
19
 
20
- comment.text.must_equal text
21
- comment.clean?.must_equal true
20
+ _(comment.text).must_equal text
21
+ _(comment.clean?).must_equal true
22
+ end
23
+
24
+ it 'can create a comment with file attachment' do
25
+ text = "Test creating a comment"
26
+ comment = nil
27
+ files = [File.expand_path('../Gemfile', File.dirname(__FILE__))]
28
+ VCR.use_cassette('create comment with attachment', record: :new_episodes) do
29
+ comment = story.create_comment(text: text, files: files)
30
+ end
31
+ _(comment.text).must_equal text
32
+ _(comment.attachments.size).must_equal 1
33
+ _(comment.clean?).must_equal true
22
34
  end
23
35
 
24
36
  it 'can update an existing comment' do
@@ -29,7 +41,37 @@ describe TrackerApi::Resources::Comment do
29
41
  existing_comment.save
30
42
  end
31
43
 
32
- existing_comment.text.must_equal new_text
33
- existing_comment.clean?.must_equal true
44
+ _(existing_comment.text).must_equal new_text
45
+ _(existing_comment.clean?).must_equal true
46
+ end
47
+
48
+ it 'can create attachments in a comment' do
49
+ files = [File.expand_path('../Gemfile', File.dirname(__FILE__))]
50
+ VCR.use_cassette('create attachments', record: :new_episodes) do
51
+ existing_comment.create_attachments(files: files)
52
+ _(existing_comment.attachments.size).must_equal 1
53
+ _(existing_comment.clean?).must_equal true
54
+ end
55
+ end
56
+
57
+ it 'can delete attachments in a comment' do
58
+ files = [File.expand_path('../Gemfile', File.dirname(__FILE__))]
59
+ VCR.use_cassette('delete attachments', record: :new_episodes) do
60
+ existing_comment.create_attachments(files: files)
61
+ _(existing_comment.attachments.size).must_equal 1
62
+ existing_comment.delete_attachments
63
+ _(existing_comment.attachments.size).must_equal 0
64
+ end
65
+ end
66
+
67
+ it 'can delete a comment' do
68
+ VCR.use_cassette('delete comment', record: :new_episodes) do
69
+ current_story = project.story(story_id)
70
+ new_comment_id = current_story.create_comment(text: "test comment").id
71
+ _(current_story.comments.last.id).must_equal new_comment_id
72
+ current_story.comments.last.delete
73
+ current_story = project.story(story_id)
74
+ _(current_story.comments.last.id).wont_equal new_comment_id
75
+ end
34
76
  end
35
77
  end
@@ -0,0 +1,47 @@
1
+ require_relative 'minitest_helper'
2
+
3
+ describe TrackerApi::Error do
4
+ let(:pt_user) { PT_USER_1 }
5
+ let(:client) { TrackerApi::Client.new token: pt_user[:token] }
6
+ let(:options) { { url: nil, headers: nil } }
7
+
8
+ it 'raises ClientError for 4xx HTTP status codes' do
9
+ (400..499).each do |status_code|
10
+ mock_faraday_error(status_code)
11
+ assert_raises TrackerApi::Errors::ClientError do
12
+ client.send(:request, :get, options)
13
+ end
14
+ end
15
+ end
16
+
17
+ it 'raises ServerError for 5xx HTTP status codes' do
18
+ (500..599).each do |status_code|
19
+ mock_faraday_error(status_code)
20
+ assert_raises TrackerApi::Errors::ServerError do
21
+ client.send(:request, :get, options)
22
+ end
23
+ end
24
+ end
25
+
26
+ it 'raises RuntimeError for HTTP status codes < 400 and > 500' do
27
+ [399, 600].each do |status_code|
28
+ mock_faraday_error(status_code)
29
+ assert_raises RuntimeError, "Expected 4xx or 5xx HTTP status code" do
30
+ client.send(:request, :get, options)
31
+ end
32
+ end
33
+ end
34
+
35
+ # Simulate the error Faraday will raise with a specific HTTP status code so
36
+ # we can test our rescuing of those errors
37
+ def mock_faraday_error(status_code)
38
+ mocked_error_class = if (500..599).include?(status_code) && Faraday::VERSION.to_f >= 16.0
39
+ Faraday::ServerError
40
+ else
41
+ Faraday::ClientError
42
+ end
43
+
44
+ ::Faraday::Connection.any_instance.stubs(:get).
45
+ raises(mocked_error_class.new(nil, { status: status_code}))
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'minitest_helper'
2
+
3
+ describe TrackerApi::Resources::FileAttachment do
4
+ let(:pt_user) { PT_USER_1 }
5
+ let(:client) { TrackerApi::Client.new token: pt_user[:token] }
6
+ let(:project_id) { pt_user[:project_id] }
7
+ let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
8
+ let(:story_id) { '66728004' }
9
+ let(:story) { VCR.use_cassette('get story') { project.story(story_id) } }
10
+
11
+ it 'can be deleted' do
12
+ VCR.use_cassette('delete an attachment', record: :new_episodes) do
13
+ comment_with_attachments = story.create_comment(text: "test comment", files: [File.expand_path('../Gemfile', File.dirname(__FILE__))])
14
+ _(comment_with_attachments.attachments(reload: true).size).must_equal 1
15
+ comment_with_attachments.attachments.first.delete
16
+ _(comment_with_attachments.attachments(reload: true).size).must_equal 0
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,31 @@
1
+ require_relative 'minitest_helper'
2
+
3
+ describe TrackerApi::Resources::Iteration do
4
+ let(:pt_user) { PT_USER_1 }
5
+ let(:client) { TrackerApi::Client.new token: pt_user[:token] }
6
+ let(:project_id) { pt_user[:project_id] }
7
+ let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
8
+ let(:iteration) { VCR.use_cassette('get current iteration') { project.iterations(scope: "current").first } }
9
+
10
+ describe "#cycle_time_details" do
11
+ it "gets all cycle_time_details for this iteration" do
12
+ VCR.use_cassette('get cycle time details', record: :new_episodes) do
13
+ cycle_time_details = iteration.cycle_time_details
14
+
15
+ cycle_time_details.wont_be_empty
16
+ cycle_time_detail = cycle_time_details.first
17
+ cycle_time_detail.must_be_instance_of TrackerApi::Resources::CycleTimeDetails
18
+ end
19
+ end
20
+ end
21
+
22
+ describe "#get_history" do
23
+ it "gets all history for a particular iteration" do
24
+ VCR.use_cassette('get daily history container', record: :new_episodes) do
25
+ daily_history_container = iteration.get_history
26
+
27
+ daily_history_container.must_be_instance_of TrackerApi::Resources::DailyHistoryContainer
28
+ end
29
+ end
30
+ end
31
+ end
@@ -6,7 +6,10 @@ Coveralls.wear!
6
6
 
7
7
  require 'minitest/byebug' if ENV['DEBUG']
8
8
  require 'minitest/autorun'
9
- require 'mocha/mini_test'
9
+
10
+ require 'mocha'
11
+ require('mocha/minitest')
12
+
10
13
  require 'awesome_print'
11
14
  require 'multi_json'
12
15
  require 'vcr'
@@ -20,7 +23,7 @@ VCR.configure do |c|
20
23
  c.ignore_localhost = true
21
24
  c.cassette_library_dir = File.expand_path('../vcr/cassettes', __FILE__).to_s
22
25
  c.default_cassette_options = { serialize_with: :json }
23
- c.hook_into :excon
26
+ c.hook_into :faraday
24
27
  c.allow_http_connections_when_no_cassette = false
25
28
  end
26
29
 
@@ -11,9 +11,9 @@ describe TrackerApi::Resources::Project do
11
11
  VCR.use_cassette('get epics', record: :new_episodes) do
12
12
  epics = project.epics
13
13
 
14
- epics.wont_be_empty
14
+ _(epics).wont_be_empty
15
15
  epic = epics.first
16
- epic.must_be_instance_of TrackerApi::Resources::Epic
16
+ _(epic).must_be_instance_of TrackerApi::Resources::Epic
17
17
  end
18
18
  end
19
19
 
@@ -28,9 +28,9 @@ describe TrackerApi::Resources::Project do
28
28
  it 'does not make an extra request' do
29
29
  epics = project_with_epics.epics
30
30
 
31
- epics.wont_be_empty
31
+ _(epics).wont_be_empty
32
32
  epic = epics.first
33
- epic.must_be_instance_of TrackerApi::Resources::Epic
33
+ _(epic).must_be_instance_of TrackerApi::Resources::Epic
34
34
  end
35
35
  end
36
36
  end
@@ -46,9 +46,9 @@ describe TrackerApi::Resources::Project do
46
46
  it 'gets all labels for this project' do
47
47
  labels = project_with_labels.labels
48
48
 
49
- labels.wont_be_empty
49
+ _(labels).wont_be_empty
50
50
  label = labels.first
51
- label.must_be_instance_of TrackerApi::Resources::Label
51
+ _(label).must_be_instance_of TrackerApi::Resources::Label
52
52
  end
53
53
  end
54
54
 
@@ -56,9 +56,9 @@ describe TrackerApi::Resources::Project do
56
56
  VCR.use_cassette('get labels', record: :new_episodes) do
57
57
  labels = project.labels
58
58
 
59
- labels.wont_be_empty
59
+ _(labels).wont_be_empty
60
60
  label = labels.first
61
- label.must_be_instance_of TrackerApi::Resources::Label
61
+ _(label).must_be_instance_of TrackerApi::Resources::Label
62
62
  end
63
63
  end
64
64
  end
@@ -69,11 +69,11 @@ describe TrackerApi::Resources::Project do
69
69
  offset = -project.number_of_done_iterations_to_show.to_i
70
70
  done_iterations = project.iterations(scope: :done, offset: offset)
71
71
 
72
- done_iterations.wont_be_empty
73
- done_iterations.length.must_be :<=, project.number_of_done_iterations_to_show
72
+ _(done_iterations).wont_be_empty
73
+ _(done_iterations.length).must_be :<=, project.number_of_done_iterations_to_show
74
74
 
75
75
  iteration = done_iterations.first
76
- iteration.must_be_instance_of TrackerApi::Resources::Iteration
76
+ _(iteration).must_be_instance_of TrackerApi::Resources::Iteration
77
77
  end
78
78
  end
79
79
 
@@ -81,14 +81,14 @@ describe TrackerApi::Resources::Project do
81
81
  VCR.use_cassette('get current iteration', record: :new_episodes) do
82
82
  iterations = project.iterations(scope: :current)
83
83
 
84
- iterations.wont_be_empty
84
+ _(iterations).wont_be_empty
85
85
 
86
86
  current = iterations.first
87
- current.must_be_instance_of TrackerApi::Resources::Iteration
88
- current.stories.wont_be_empty
87
+ _(current).must_be_instance_of TrackerApi::Resources::Iteration
88
+ _(current.stories).wont_be_empty
89
89
 
90
90
  story = current.stories.first
91
- story.must_be_instance_of TrackerApi::Resources::Story
91
+ _(story).must_be_instance_of TrackerApi::Resources::Story
92
92
  end
93
93
  end
94
94
 
@@ -96,13 +96,13 @@ describe TrackerApi::Resources::Project do
96
96
  VCR.use_cassette('get current iteration', record: :new_episodes) do
97
97
  iterations = project.iterations(scope: :current, fields: ":default,velocity,points,accepted_points,effective_points")
98
98
 
99
- iterations.wont_be_empty
99
+ _(iterations).wont_be_empty
100
100
 
101
101
  current = iterations.first
102
- current.velocity.must_equal 10.0
103
- current.points.must_equal 9.0
104
- current.accepted_points.must_equal 0
105
- current.effective_points.must_equal 9.0
102
+ _(current.velocity).must_equal 10.0
103
+ _(current.points).must_equal 9.0
104
+ _(current.accepted_points).must_equal 0
105
+ _(current.effective_points).must_equal 9.0
106
106
  end
107
107
  end
108
108
 
@@ -110,26 +110,26 @@ describe TrackerApi::Resources::Project do
110
110
  VCR.use_cassette('get iteration by number', record: :new_episodes) do
111
111
  iterations = project.iterations(number: 2)
112
112
 
113
- iterations.size.must_equal 1
114
- iterations.first.must_be_instance_of TrackerApi::Resources::Iteration
115
- iterations.first.number.must_equal 2
113
+ _(iterations.size).must_equal 1
114
+ _(iterations.first).must_be_instance_of TrackerApi::Resources::Iteration
115
+ _(iterations.first.number).must_equal 2
116
116
 
117
117
  iterations = project.iterations(number: 1)
118
118
 
119
- iterations.size.must_equal 1
120
- iterations.first.must_be_instance_of TrackerApi::Resources::Iteration
121
- iterations.first.number.must_equal 1
119
+ _(iterations.size).must_equal 1
120
+ _(iterations.first).must_be_instance_of TrackerApi::Resources::Iteration
121
+ _(iterations.first.number).must_equal 1
122
122
 
123
123
  iterations = project.iterations(number: 10_000)
124
124
 
125
- iterations.must_be_empty
125
+ _(iterations).must_be_empty
126
126
  end
127
127
  end
128
128
 
129
129
  it 'requires an iteration number > 0' do
130
130
  VCR.use_cassette('get iteration by number', record: :new_episodes) do
131
- -> { project.iterations(number: 0) }.must_raise(ArgumentError, /> 0/)
132
- -> { project.iterations(number: -1) }.must_raise(ArgumentError, /> 0/)
131
+ _(-> { project.iterations(number: 0) }).must_raise(ArgumentError, /> 0/)
132
+ _(-> { project.iterations(number: -1) }).must_raise(ArgumentError, /> 0/)
133
133
  end
134
134
  end
135
135
  end
@@ -139,11 +139,11 @@ describe TrackerApi::Resources::Project do
139
139
  VCR.use_cassette('get unscheduled stories', record: :new_episodes) do
140
140
  stories = project.stories(with_state: :unscheduled)
141
141
 
142
- stories.wont_be_empty
142
+ _(stories).wont_be_empty
143
143
 
144
144
  story = stories.first
145
- story.must_be_instance_of TrackerApi::Resources::Story
146
- story.current_state.must_equal 'unscheduled'
145
+ _(story).must_be_instance_of TrackerApi::Resources::Story
146
+ _(story.current_state).must_equal 'unscheduled'
147
147
  end
148
148
  end
149
149
 
@@ -151,10 +151,10 @@ describe TrackerApi::Resources::Project do
151
151
  VCR.use_cassette('create story') do
152
152
  story = project.create_story(name: 'Test story')
153
153
 
154
- story.must_be_instance_of TrackerApi::Resources::Story
155
- story.id.wont_be_nil
156
- story.id.must_be :>, 0
157
- story.name.must_equal 'Test story'
154
+ _(story).must_be_instance_of TrackerApi::Resources::Story
155
+ _(_(story.id)).wont_be_nil
156
+ _(story.id).must_be :>, 0
157
+ _(story.name).must_equal 'Test story'
158
158
  end
159
159
  end
160
160
 
@@ -162,10 +162,10 @@ describe TrackerApi::Resources::Project do
162
162
  VCR.use_cassette('create story with lengthy params') do
163
163
  story = project.create_story(name: 'Test story', description: ('Test description ' * 500))
164
164
 
165
- story.must_be_instance_of TrackerApi::Resources::Story
166
- story.id.wont_be_nil
167
- story.id.must_be :>, 0
168
- story.description.must_equal ('Test description ' * 500)
165
+ _(story).must_be_instance_of TrackerApi::Resources::Story
166
+ _(_(story.id)).wont_be_nil
167
+ _(story.id).must_be :>, 0
168
+ _(story.description).must_equal ('Test description ' * 500)
169
169
  end
170
170
  end
171
171
  end
@@ -186,9 +186,9 @@ describe TrackerApi::Resources::Project do
186
186
  VCR.use_cassette('get project activity', record: :new_episodes) do
187
187
  activity = project.activity
188
188
 
189
- activity.wont_be_empty
189
+ _(activity).wont_be_empty
190
190
  event = activity.first
191
- event.must_be_instance_of TrackerApi::Resources::Activity
191
+ _(event).must_be_instance_of TrackerApi::Resources::Activity
192
192
  end
193
193
  end
194
194
  end
@@ -201,11 +201,23 @@ describe TrackerApi::Resources::Project do
201
201
  project = client.project(pt_user[:project_id])
202
202
  search_container = project.search('name:"story to test search"')
203
203
 
204
- search_container.wont_be_nil
205
- search_container.must_be_instance_of TrackerApi::Resources::SearchResultContainer
206
- search_container.epics.must_be_instance_of TrackerApi::Resources::EpicsSearchResult
207
- search_container.stories.must_be_instance_of TrackerApi::Resources::StoriesSearchResult
208
- search_container.stories.stories.first[:id].must_equal 143444685
204
+ _(search_container).wont_be_nil
205
+ _(search_container).must_be_instance_of TrackerApi::Resources::SearchResultContainer
206
+ _(search_container.epics).must_be_instance_of TrackerApi::Resources::EpicsSearchResult
207
+ _(search_container.stories).must_be_instance_of TrackerApi::Resources::StoriesSearchResult
208
+ _(search_container.stories.stories.first[:id]).must_equal 143444685
209
+ end
210
+ end
211
+ end
212
+
213
+ describe '.releases' do
214
+ it 'gets all of the releases for the project' do
215
+ VCR.use_cassette('get releases', record: :new_episodes) do
216
+ releases = project.releases
217
+
218
+ _(releases).wont_be_empty
219
+ _(releases.size).must_equal 3
220
+ _(releases.first).must_be_instance_of TrackerApi::Resources::Release
209
221
  end
210
222
  end
211
223
  end