tracker_api 1.9.1 → 1.10.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a65aa29413649912595c37c00d2e8ee08a0c86d0011799749d4d8bc5182a6900
4
- data.tar.gz: b45f9f13846ec255a83d8423931da2909a494d5ac6e1a78d21c4a0a5eb84f968
3
+ metadata.gz: f6a323c00b8ccebfae8dd61b3762861708ed452c8c6672080497941cfc7f142d
4
+ data.tar.gz: 5203f36907828fddce2c7e8966963d2e89fa5fe8a1f4cd36a73d019698d8cc82
5
5
  SHA512:
6
- metadata.gz: cdaac226ae1997ff05a7a300853c5a5d47d8251960999e2ef7204573567e79b9ae0d23cc2153ddfa1cd3dee2c23d3f04d0263ce9cc59cd0e3a1e538ee1826853
7
- data.tar.gz: 922277c51eeac8e25016502fb8574167c01c86ca8bd9b51936aca2d3931c9a71ef6993adfa8597a4b15085c0c24635b30652d6a470e6f73efeb5d27d74bb7130
6
+ metadata.gz: 350420e48c0a1fc47ab05855b861adb717420876856ed6d365da8f4f17613183dc35513eb0497debb7c6dfa9eae0821e419b79750b75ba8b4a16fc061e82bf34
7
+ data.tar.gz: 51a26e915a6e943bebb0caac96840050c4c99b70edb57041919bb1e9f21a5d9103270b17fb0bd67c970ebe859dfb2a26deaa28b309f5ac4f7f8bec4911a49c3f
@@ -223,7 +223,7 @@ module TrackerApi
223
223
  req.body = body
224
224
  end
225
225
  response
226
- rescue Faraday::Error::ClientError => e
226
+ rescue Faraday::ClientError, Faraday::ServerError => e
227
227
  status_code = e.response[:status]
228
228
  case status_code
229
229
  when 400..499 then raise TrackerApi::Errors::ClientError.new(e)
@@ -5,14 +5,24 @@ module TrackerApi
5
5
  def initialize(wrapped_exception)
6
6
  @wrapped_exception = wrapped_exception
7
7
  @response = wrapped_exception.response
8
- message = if wrapped_exception.is_a?(Faraday::Error::ParsingError)
8
+ message = if wrapped_exception.is_a?(Faraday::ParsingError)
9
9
  wrapped_exception.message
10
- elsif wrapped_exception.is_a?(Faraday::Error::ClientError)
10
+ elsif faraday_response_error?(wrapped_exception)
11
11
  wrapped_exception.response.inspect
12
12
  else
13
13
  wrapped_exception.instance_variable_get(:@wrapped_exception).inspect
14
14
  end
15
15
  super(message)
16
16
  end
17
+
18
+ private
19
+
20
+ # faraday 16.0 re-organized their errors. The errors we're interested in,
21
+ # Faraday::ClientError before 16.0 and Faraday::ServerError introduced in
22
+ # 16.0, are represented by this conditional.
23
+ def faraday_response_error?(wrapped_exception)
24
+ wrapped_exception.is_a?(Faraday::Error) &&
25
+ wrapped_exception.respond_to?(:response)
26
+ end
17
27
  end
18
28
  end
@@ -54,6 +54,7 @@ module TrackerApi
54
54
  property :deadline
55
55
  property :requested_by_id
56
56
  property :owner_ids, if: ->(_) { !owner_ids.blank? }
57
+ property :project_id
57
58
 
58
59
  # Use render_empty: false to address: https://github.com/dashofcode/tracker_api/issues/110
59
60
  # - The default value of the labels attribute in Resources::Story is an empty array.
@@ -165,6 +166,17 @@ module TrackerApi
165
166
  end
166
167
  end
167
168
 
169
+ # Returns the story's original ("undirtied") project_id
170
+ #
171
+ # @return Integer
172
+ def project_id
173
+ if dirty_attributes.key?(:project_id)
174
+ original_attributes[:project_id]
175
+ else
176
+ @project_id
177
+ end
178
+ end
179
+
168
180
  # @param [Hash] params attributes to create the task with
169
181
  # @return [Task] newly created Task
170
182
  def create_task(params)
@@ -1,3 +1,3 @@
1
1
  module TrackerApi
2
- VERSION = '1.9.1'
2
+ VERSION = '1.10.0'
3
3
  end
@@ -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,8 @@ 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
22
  end
23
23
 
24
24
  it 'can create a comment with file attachment' do
@@ -28,9 +28,9 @@ describe TrackerApi::Resources::Comment do
28
28
  VCR.use_cassette('create comment with attachment', record: :new_episodes) do
29
29
  comment = story.create_comment(text: text, files: files)
30
30
  end
31
- comment.text.must_equal text
32
- comment.attachments.size.must_equal 1
33
- comment.clean?.must_equal true
31
+ _(comment.text).must_equal text
32
+ _(comment.attachments.size).must_equal 1
33
+ _(comment.clean?).must_equal true
34
34
  end
35
35
 
36
36
  it 'can update an existing comment' do
@@ -41,16 +41,16 @@ describe TrackerApi::Resources::Comment do
41
41
  existing_comment.save
42
42
  end
43
43
 
44
- existing_comment.text.must_equal new_text
45
- existing_comment.clean?.must_equal true
44
+ _(existing_comment.text).must_equal new_text
45
+ _(existing_comment.clean?).must_equal true
46
46
  end
47
47
 
48
48
  it 'can create attachments in a comment' do
49
49
  files = [File.expand_path('../Gemfile', File.dirname(__FILE__))]
50
50
  VCR.use_cassette('create attachments', record: :new_episodes) do
51
51
  existing_comment.create_attachments(files: files)
52
- existing_comment.attachments.size.must_equal 1
53
- existing_comment.clean?.must_equal true
52
+ _(existing_comment.attachments.size).must_equal 1
53
+ _(existing_comment.clean?).must_equal true
54
54
  end
55
55
  end
56
56
 
@@ -58,9 +58,9 @@ describe TrackerApi::Resources::Comment do
58
58
  files = [File.expand_path('../Gemfile', File.dirname(__FILE__))]
59
59
  VCR.use_cassette('delete attachments', record: :new_episodes) do
60
60
  existing_comment.create_attachments(files: files)
61
- existing_comment.attachments.size.must_equal 1
61
+ _(existing_comment.attachments.size).must_equal 1
62
62
  existing_comment.delete_attachments
63
- existing_comment.attachments.size.must_equal 0
63
+ _(existing_comment.attachments.size).must_equal 0
64
64
  end
65
65
  end
66
66
 
@@ -68,10 +68,10 @@ describe TrackerApi::Resources::Comment do
68
68
  VCR.use_cassette('delete comment', record: :new_episodes) do
69
69
  current_story = project.story(story_id)
70
70
  new_comment_id = current_story.create_comment(text: "test comment").id
71
- current_story.comments.last.id.must_equal new_comment_id
71
+ _(current_story.comments.last.id).must_equal new_comment_id
72
72
  current_story.comments.last.delete
73
73
  current_story = project.story(story_id)
74
- current_story.comments.last.id.wont_equal new_comment_id
74
+ _(current_story.comments.last.id).wont_equal new_comment_id
75
75
  end
76
76
  end
77
77
  end
@@ -22,7 +22,7 @@ describe TrackerApi::Error do
22
22
  end
23
23
  end
24
24
  end
25
-
25
+
26
26
  it 'raises RuntimeError for HTTP status codes < 400 and > 500' do
27
27
  [399, 600].each do |status_code|
28
28
  mock_faraday_error(status_code)
@@ -35,7 +35,13 @@ describe TrackerApi::Error do
35
35
  # Simulate the error Faraday will raise with a specific HTTP status code so
36
36
  # we can test our rescuing of those errors
37
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
+
38
44
  ::Faraday::Connection.any_instance.stubs(:get).
39
- raises(::Faraday::Error::ClientError.new(nil, { status: status_code}))
45
+ raises(mocked_error_class.new(nil, { status: status_code}))
40
46
  end
41
47
  end
@@ -11,9 +11,9 @@ describe TrackerApi::Resources::FileAttachment do
11
11
  it 'can be deleted' do
12
12
  VCR.use_cassette('delete an attachment', record: :new_episodes) do
13
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
14
+ _(comment_with_attachments.attachments(reload: true).size).must_equal 1
15
15
  comment_with_attachments.attachments.first.delete
16
- comment_with_attachments.attachments(reload: true).size.must_equal 0
16
+ _(comment_with_attachments.attachments(reload: true).size).must_equal 0
17
17
  end
18
18
  end
19
19
  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
+ Mocha::VERSION.to_f >= 1.9 ? require('mocha/minitest') : require('mocha/mini_test')
12
+
10
13
  require 'awesome_print'
11
14
  require 'multi_json'
12
15
  require 'vcr'
@@ -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,11 @@ 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
209
  end
210
210
  end
211
211
  end
@@ -215,9 +215,9 @@ describe TrackerApi::Resources::Project do
215
215
  VCR.use_cassette('get releases', record: :new_episodes) do
216
216
  releases = project.releases
217
217
 
218
- releases.wont_be_empty
219
- releases.size.must_equal 3
220
- releases.first.must_be_instance_of TrackerApi::Resources::Release
218
+ _(releases).wont_be_empty
219
+ _(releases.size).must_equal 3
220
+ _(releases.first).must_be_instance_of TrackerApi::Resources::Release
221
221
  end
222
222
  end
223
223
  end
@@ -10,12 +10,12 @@ describe TrackerApi::Resources::Release do
10
10
  it 'returns all the stories related to a release' do
11
11
  releases = VCR.use_cassette('get releases') { project.releases }
12
12
  release = releases.find { |release| release.name == 'Beta launch' }
13
-
13
+
14
14
  VCR.use_cassette('release stories', record: :new_episodes) do
15
15
  stories = release.stories
16
16
 
17
- stories.size.must_equal 9
18
- stories.first.must_be_instance_of TrackerApi::Resources::Story
17
+ _(stories.size).must_equal 9
18
+ _(stories.first).must_be_instance_of TrackerApi::Resources::Story
19
19
  end
20
20
  end
21
21
  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,7 @@ 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
302
  end
303
303
  end
304
304
  end
@@ -20,8 +20,8 @@ describe TrackerApi::Resources::Task do
20
20
  task.save
21
21
  end
22
22
 
23
- task.description.must_equal new_description
24
- task.complete.must_equal true
25
- task.clean?.must_equal true
23
+ _(task.description).must_equal new_description
24
+ _(task.complete).must_equal true
25
+ _(task.clean?).must_equal true
26
26
  end
27
27
  end
@@ -12,13 +12,13 @@ describe TrackerApi::Resources::Workspace do
12
12
  workspace = client.workspace(pt_user[:workspace_id], fields: ':default,projects(id,name)')
13
13
  projects = workspace.projects
14
14
 
15
- projects.wont_be_empty
15
+ _(projects).wont_be_empty
16
16
 
17
- projects.size.must_equal 2
18
- projects.first.must_be_instance_of TrackerApi::Resources::Project
17
+ _(projects.size).must_equal 2
18
+ _(projects.first).must_be_instance_of TrackerApi::Resources::Project
19
19
 
20
- pt_user[:project_ids].must_include projects.first.id
21
- pt_user[:project_ids].must_include projects.last.id
20
+ _(pt_user[:project_ids]).must_include projects.first.id
21
+ _(pt_user[:project_ids]).must_include projects.last.id
22
22
  end
23
23
  end
24
24
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'bundler', '> 1.3', '< 2.1'
22
22
  spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'minitest'
24
24
  spec.add_development_dependency 'mocha'
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracker_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Forest Carlisle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-08 00:00:00.000000000 Z
11
+ date: 2019-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.1'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.3'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.1'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement