tracker_api 1.8.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -1
  3. data/README.md +4 -0
  4. data/lib/tracker_api.rb +12 -0
  5. data/lib/tracker_api/client.rb +8 -6
  6. data/lib/tracker_api/endpoints/blockers.rb +20 -0
  7. data/lib/tracker_api/endpoints/iteration.rb +35 -0
  8. data/lib/tracker_api/endpoints/release.rb +17 -0
  9. data/lib/tracker_api/endpoints/releases.rb +20 -0
  10. data/lib/tracker_api/endpoints/review.rb +21 -0
  11. data/lib/tracker_api/endpoints/reviews.rb +21 -0
  12. data/lib/tracker_api/endpoints/search.rb +1 -1
  13. data/lib/tracker_api/endpoints/stories.rb +10 -0
  14. data/lib/tracker_api/error.rb +12 -2
  15. data/lib/tracker_api/resources/blocker.rb +18 -0
  16. data/lib/tracker_api/resources/cycle_time_details.rb +21 -0
  17. data/lib/tracker_api/resources/daily_history_container.rb +13 -0
  18. data/lib/tracker_api/resources/iteration.rb +14 -0
  19. data/lib/tracker_api/resources/project.rb +13 -0
  20. data/lib/tracker_api/resources/release.rb +29 -0
  21. data/lib/tracker_api/resources/review.rb +35 -0
  22. data/lib/tracker_api/resources/review_type.rb +15 -0
  23. data/lib/tracker_api/resources/story.rb +26 -0
  24. data/lib/tracker_api/version.rb +1 -1
  25. data/test/client_test.rb +52 -52
  26. data/test/comment_test.rb +13 -13
  27. data/test/error_test.rb +8 -2
  28. data/test/file_attachment_test.rb +4 -4
  29. data/test/iteration_test.rb +31 -0
  30. data/test/minitest_helper.rb +5 -2
  31. data/test/project_test.rb +59 -47
  32. data/test/release_test.rb +22 -0
  33. data/test/review_test.rb +27 -0
  34. data/test/story_test.rb +65 -48
  35. data/test/task_test.rb +3 -3
  36. data/test/vcr/cassettes/create_attachments.json +1 -1
  37. data/test/vcr/cassettes/create_comment_with_attachment.json +1 -1
  38. data/test/vcr/cassettes/delete_an_attachment.json +1 -1
  39. data/test/vcr/cassettes/delete_attachments.json +1 -1
  40. data/test/vcr/cassettes/get_current_iteration.json +1 -1
  41. data/test/vcr/cassettes/get_cycle_time_details.json +1 -0
  42. data/test/vcr/cassettes/get_daily_history_container.json +1 -0
  43. data/test/vcr/cassettes/get_releases.json +1 -0
  44. data/test/vcr/cassettes/get_story_reviews.json +1 -0
  45. data/test/vcr/cassettes/release_stories.json +1 -0
  46. data/test/vcr/cassettes/save_review.json +1 -0
  47. data/test/vcr/cassettes/search_project.json +1 -1
  48. data/test/workspace_test.rb +5 -5
  49. data/tracker_api.gemspec +1 -1
  50. metadata +35 -6
@@ -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
@@ -0,0 +1,22 @@
1
+ require_relative 'minitest_helper'
2
+
3
+ describe TrackerApi::Resources::Release 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
+
9
+ describe '.stories' do
10
+ it 'returns all the stories related to a release' do
11
+ releases = VCR.use_cassette('get releases') { project.releases }
12
+ release = releases.find { |release| release.name == 'Beta launch' }
13
+
14
+ VCR.use_cassette('release stories', record: :new_episodes) do
15
+ stories = release.stories
16
+
17
+ _(stories.size).must_equal 9
18
+ _(stories.first).must_be_instance_of TrackerApi::Resources::Story
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ require_relative 'minitest_helper'
2
+
3
+ describe TrackerApi::Resources::Review do
4
+ let(:pt_user) { PT_USER_1 }
5
+ let(:client) { TrackerApi::Client.new token: pt_user[:token] }
6
+ let(:story) do
7
+ TrackerApi::Resources::Story.new(
8
+ client: client,
9
+ project_id: pt_user[:project_id],
10
+ id: '66728004'
11
+ )
12
+ end
13
+ let(:reviews) { VCR.use_cassette('get story reviews') { story.reviews } }
14
+ let(:existing_review) { reviews.first }
15
+
16
+ it 'can update an existing review' do
17
+ new_state = 'pass'
18
+ existing_review.status = new_state
19
+
20
+ VCR.use_cassette('save review', record: :new_episodes) do
21
+ existing_review.save
22
+ end
23
+
24
+ _(existing_review.status).must_equal new_state
25
+ _(existing_review.clean?).must_equal true
26
+ end
27
+ end
@@ -22,8 +22,8 @@ describe TrackerApi::Resources::Story do
22
22
  story.save
23
23
  end
24
24
 
25
- story.name.must_equal new_name
26
- story.clean?.must_equal true
25
+ _(story.name).must_equal new_name
26
+ _(story.clean?).must_equal true
27
27
  end
28
28
 
29
29
  it 'can update multiple attributes of an existing story at once' do
@@ -36,14 +36,14 @@ describe TrackerApi::Resources::Story do
36
36
  story.save
37
37
  end
38
38
 
39
- story.name.must_equal new_name
40
- story.description.must_equal new_desc
39
+ _(story.name).must_equal new_name
40
+ _(story.description).must_equal new_desc
41
41
  end
42
42
 
43
43
  it 'can add new labels to an existing story' do
44
44
  new_label_name = "super-special-label"
45
45
 
46
- story.labels.map(&:name).wont_include new_label_name
46
+ _(story.labels.map(&:name)).wont_include new_label_name
47
47
 
48
48
  story.add_label(new_label_name)
49
49
 
@@ -51,13 +51,13 @@ describe TrackerApi::Resources::Story do
51
51
  story.save
52
52
  end
53
53
 
54
- story.labels.wont_be_empty
55
- story.labels.map(&:name).must_include new_label_name
54
+ _(story.labels).wont_be_empty
55
+ _(story.labels.map(&:name)).must_include new_label_name
56
56
  end
57
57
 
58
58
  it 'can add new labels to an existing story without existing labels' do
59
59
  story = VCR.use_cassette('get story no existing labels') { project.story(story_id_no_existing_labels) }
60
- story.labels.must_be_nil
60
+ _(story.labels).must_be_nil
61
61
 
62
62
  new_label_name = "super-special-label"
63
63
  story.add_label(new_label_name)
@@ -66,8 +66,8 @@ describe TrackerApi::Resources::Story do
66
66
  story.save
67
67
  end
68
68
 
69
- story.labels.wont_be_empty
70
- story.labels.map(&:name).must_include new_label_name
69
+ _(story.labels).wont_be_empty
70
+ _(story.labels.map(&:name)).must_include new_label_name
71
71
  end
72
72
 
73
73
  it 'does not remove existing labels when updating story fields' do
@@ -86,15 +86,15 @@ describe TrackerApi::Resources::Story do
86
86
  story_in_epic.save
87
87
  end
88
88
 
89
- story_in_epic.labels.must_equal original_labels
90
- story_in_epic.label_list.must_equal original_label_list
89
+ _(story_in_epic.labels).must_equal original_labels
90
+ _(story_in_epic.label_list).must_equal original_label_list
91
91
  end
92
92
 
93
93
  it 'does not send unmodified fields when saving' do
94
94
  story_with_one_change = TrackerApi::Resources::Story::UpdateRepresenter.new(TrackerApi::Resources::Story.new(name: "new_name"))
95
95
  expected_json = MultiJson.dump({name: "new_name"})
96
96
 
97
- expected_json.must_equal story_with_one_change.to_json
97
+ _(expected_json).must_equal story_with_one_change.to_json
98
98
  end
99
99
 
100
100
  it 'objects are equal based on id' do
@@ -102,15 +102,15 @@ describe TrackerApi::Resources::Story do
102
102
  story_b = VCR.use_cassette('get story') { project.story(story_id) }
103
103
  story_c = VCR.use_cassette('get another story') { project.story(another_story_id) }
104
104
 
105
- story_a.must_equal story_b
106
- story_a.hash.must_equal story_b.hash
107
- story_a.eql?(story_b).must_equal true
108
- story_a.equal?(story_b).must_equal false
105
+ _(story_a).must_equal story_b
106
+ _(story_a.hash).must_equal story_b.hash
107
+ _(story_a.eql?(story_b)).must_equal true
108
+ _(story_a.equal?(story_b)).must_equal false
109
109
 
110
- story_a.wont_equal story_c
111
- story_a.hash.wont_equal story_c.hash
112
- story_a.eql?(story_c).must_equal false
113
- story_a.equal?(story_c).must_equal false
110
+ _(story_a).wont_equal story_c
111
+ _(story_a.hash).wont_equal story_c.hash
112
+ _(story_a.eql?(story_c)).must_equal false
113
+ _(story_a.equal?(story_c)).must_equal false
114
114
  end
115
115
 
116
116
  describe '.owners' do
@@ -123,9 +123,9 @@ describe TrackerApi::Resources::Story do
123
123
  # it should not be making another HTTP request.
124
124
  owners = story.owners
125
125
 
126
- owners.wont_be_empty
126
+ _(owners).wont_be_empty
127
127
  owner = owners.first
128
- owner.must_be_instance_of TrackerApi::Resources::Person
128
+ _(owner).must_be_instance_of TrackerApi::Resources::Person
129
129
  end
130
130
 
131
131
  it 'gets all owners for this story' do
@@ -133,9 +133,9 @@ describe TrackerApi::Resources::Story do
133
133
  story = project.story(story_id)
134
134
  owners = VCR.use_cassette('get owners for story') { story.owners }
135
135
 
136
- owners.wont_be_empty
136
+ _(owners).wont_be_empty
137
137
  owner = owners.first
138
- owner.must_be_instance_of TrackerApi::Resources::Person
138
+ _(owner).must_be_instance_of TrackerApi::Resources::Person
139
139
  end
140
140
  end
141
141
  end
@@ -146,8 +146,8 @@ describe TrackerApi::Resources::Story do
146
146
  story = project.story(story_id)
147
147
  owner_ids = story.owner_ids
148
148
 
149
- owner_ids.wont_be_empty
150
- owner_ids.first.must_be_instance_of Fixnum
149
+ _(owner_ids).wont_be_empty
150
+ _(owner_ids.first).must_be_instance_of Fixnum
151
151
  end
152
152
  end
153
153
 
@@ -160,16 +160,16 @@ describe TrackerApi::Resources::Story do
160
160
  story.owner_ids = one_owner
161
161
  VCR.use_cassette('save story with one owner') { story.save }
162
162
 
163
- story.owner_ids.wont_be_empty
164
- story.owner_ids.must_equal one_owner
163
+ _(story.owner_ids).wont_be_empty
164
+ _(story.owner_ids).must_equal one_owner
165
165
 
166
166
  # save with two owners
167
167
  two_owners = [pt_user_1_id, pt_user_2_id]
168
168
  story.owner_ids = two_owners
169
169
  VCR.use_cassette('save story with two owners') { story.save }
170
170
 
171
- story.owner_ids.wont_be_empty
172
- story.owner_ids.must_equal two_owners
171
+ _(story.owner_ids).wont_be_empty
172
+ _(story.owner_ids).must_equal two_owners
173
173
  end
174
174
  end
175
175
  end
@@ -184,8 +184,8 @@ describe TrackerApi::Resources::Story do
184
184
 
185
185
  story.add_owner(TrackerApi::Resources::Person.new(id: 123))
186
186
 
187
- story.owner_ids.wont_be_empty
188
- story.owner_ids.must_equal [123]
187
+ _(story.owner_ids).wont_be_empty
188
+ _(story.owner_ids).must_equal [123]
189
189
  end
190
190
  end
191
191
 
@@ -201,8 +201,8 @@ describe TrackerApi::Resources::Story do
201
201
  # test dups are not added
202
202
  story.add_owner(123)
203
203
 
204
- story.owner_ids.wont_be_empty
205
- story.owner_ids.must_equal [123, 456]
204
+ _(story.owner_ids).wont_be_empty
205
+ _(story.owner_ids).must_equal [123, 456]
206
206
  end
207
207
  end
208
208
  end
@@ -212,9 +212,9 @@ describe TrackerApi::Resources::Story do
212
212
  VCR.use_cassette('get story with tasks', record: :new_episodes) do
213
213
  tasks = project.story(story_id, fields: ':default,tasks').tasks
214
214
 
215
- tasks.wont_be_empty
215
+ _(tasks).wont_be_empty
216
216
  task = tasks.first
217
- task.must_be_instance_of TrackerApi::Resources::Task
217
+ _(task).must_be_instance_of TrackerApi::Resources::Task
218
218
  end
219
219
  end
220
220
 
@@ -223,9 +223,9 @@ describe TrackerApi::Resources::Story do
223
223
  story = project.story(story_id)
224
224
  tasks = VCR.use_cassette('get tasks for story') { story.tasks }
225
225
 
226
- tasks.wont_be_empty
226
+ _(tasks).wont_be_empty
227
227
  task = tasks.first
228
- task.must_be_instance_of TrackerApi::Resources::Task
228
+ _(task).must_be_instance_of TrackerApi::Resources::Task
229
229
  end
230
230
  end
231
231
 
@@ -236,7 +236,7 @@ describe TrackerApi::Resources::Story do
236
236
  tasks = story.tasks
237
237
  unless tasks.empty?
238
238
  task = tasks.first
239
- task.must_be_instance_of TrackerApi::Resources::Task
239
+ _(task).must_be_instance_of TrackerApi::Resources::Task
240
240
  end
241
241
  end
242
242
  end
@@ -246,10 +246,10 @@ describe TrackerApi::Resources::Story do
246
246
  VCR.use_cassette('create task') do
247
247
  task = project.story(story_id).create_task(description: 'Test task')
248
248
 
249
- task.must_be_instance_of TrackerApi::Resources::Task
250
- task.id.wont_be_nil
251
- task.id.must_be :>, 0
252
- task.description.must_equal 'Test task'
249
+ _(task).must_be_instance_of TrackerApi::Resources::Task
250
+ _(task.id).wont_be_nil
251
+ _(task.id).must_be :>, 0
252
+ _(task.description).must_equal 'Test task'
253
253
  end
254
254
  end
255
255
  end
@@ -268,9 +268,9 @@ describe TrackerApi::Resources::Story do
268
268
  VCR.use_cassette('get story activity', record: :new_episodes) do
269
269
  activity = story.activity
270
270
 
271
- activity.wont_be_empty
271
+ _(activity).wont_be_empty
272
272
  event = activity.first
273
- event.must_be_instance_of TrackerApi::Resources::Activity
273
+ _(event).must_be_instance_of TrackerApi::Resources::Activity
274
274
  end
275
275
  end
276
276
  end
@@ -284,7 +284,7 @@ describe TrackerApi::Resources::Story do
284
284
 
285
285
  comments = story.comments
286
286
  comment = comments.first
287
- comment.must_be_instance_of TrackerApi::Resources::Comment
287
+ _(comment).must_be_instance_of TrackerApi::Resources::Comment
288
288
  end
289
289
  end
290
290
  end
@@ -298,7 +298,24 @@ describe TrackerApi::Resources::Story do
298
298
 
299
299
  transitions = story.transitions
300
300
  transition = transitions.first
301
- transition.must_be_instance_of TrackerApi::Resources::StoryTransition
301
+ _(transition).must_be_instance_of TrackerApi::Resources::StoryTransition
302
+ end
303
+ end
304
+ end
305
+
306
+ describe '.reviews' do
307
+ it 'gets all reviews (and review_types field by default) for the story' do
308
+ VCR.use_cassette('get story reviews', record: :new_episodes) do
309
+ story = TrackerApi::Resources::Story.new( client: client,
310
+ project_id: project_id,
311
+ id: story_id)
312
+
313
+ reviews = story.reviews
314
+ review = reviews.first
315
+ _(review).must_be_instance_of TrackerApi::Resources::Review
316
+ _(review.review_type).must_be_instance_of TrackerApi::Resources::ReviewType
317
+ _(review.review_type.name).must_equal 'Test (QA)'
318
+ _(review.status).must_equal 'unstarted'
302
319
  end
303
320
  end
304
321
  end