pivotal-tracker-api 0.2.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -2
  3. data/Gemfile.lock +65 -47
  4. data/README.md +7 -7
  5. data/VERSION +1 -1
  6. data/lib/pivotal-tracker-api.rb +10 -2
  7. data/lib/pivotal-tracker-api/activity.rb +52 -18
  8. data/lib/pivotal-tracker-api/analytics.rb +23 -0
  9. data/lib/pivotal-tracker-api/base.rb +14 -2
  10. data/lib/pivotal-tracker-api/client.rb +43 -21
  11. data/lib/pivotal-tracker-api/comment.rb +76 -27
  12. data/lib/pivotal-tracker-api/core_ext/string.rb +3 -0
  13. data/lib/pivotal-tracker-api/cycle_time_details.rb +43 -0
  14. data/lib/pivotal-tracker-api/file_attachment.rb +56 -0
  15. data/lib/pivotal-tracker-api/iteration.rb +73 -11
  16. data/lib/pivotal-tracker-api/label.rb +32 -0
  17. data/lib/pivotal-tracker-api/me.rb +16 -0
  18. data/lib/pivotal-tracker-api/person.rb +13 -9
  19. data/lib/pivotal-tracker-api/project.rb +76 -23
  20. data/lib/pivotal-tracker-api/service.rb +202 -0
  21. data/lib/pivotal-tracker-api/story.rb +173 -132
  22. data/lib/pivotal-tracker-api/story_transition.rb +81 -0
  23. data/lib/pivotal-tracker-api/string_extensions.rb +61 -0
  24. data/lib/pivotal-tracker-api/task.rb +56 -12
  25. data/pivotal-tracker-api.gemspec +28 -15
  26. data/test/helper.rb +1 -0
  27. data/test/test_activity.rb +79 -0
  28. data/test/test_analytics.rb +38 -0
  29. data/test/test_cycle_time_details.rb +69 -0
  30. data/test/test_iteration.rb +182 -0
  31. data/test/test_label.rb +29 -0
  32. data/test/test_me.rb +52 -0
  33. data/test/test_service.rb +67 -0
  34. data/test/test_story.rb +557 -0
  35. data/test/test_story_transition.rb +80 -0
  36. data/test/test_string_extensions.rb +37 -0
  37. metadata +29 -27
  38. data/lib/pivotal-tracker-api/attachment.rb +0 -28
  39. data/lib/pivotal-tracker-api/pivotal_service.rb +0 -141
  40. data/test/test_pivotal-tracker-api.rb +0 -7
@@ -0,0 +1,182 @@
1
+ require 'helper'
2
+
3
+ class TestIteration < Test::Unit::TestCase
4
+ context "A PitvotalAPI::Iteration" do
5
+
6
+ setup do
7
+ @iteration = PivotalAPI::Iteration.from_json({
8
+ project_id: 123,
9
+ stories: [{
10
+ id: 99,
11
+ url: "http://www.url.com",
12
+ project_id: 123,
13
+ name: "story name",
14
+ description: "story description",
15
+ # other fields purposely left out - they are tested in test_story.rb
16
+ },
17
+ {
18
+ id: 101,
19
+ url: "http://www.urltwo.com",
20
+ project_id: 123,
21
+ name: "another story name",
22
+ description: "another story description",
23
+ # other fields purposely left out - they are tested in test_story.rb
24
+ }],
25
+ story_ids: [99, 101],
26
+ number: 54,
27
+ team_strength: 0.75,
28
+ finish: "some-finish-date",
29
+ kind: "iteration",
30
+ start: "some-start-date"
31
+ })
32
+ end
33
+
34
+ should "have a valid project id" do
35
+ assert_equal(123, @iteration.project_id)
36
+ end
37
+
38
+ should "have valid stories" do
39
+ assert_equal(2, @iteration.stories.count)
40
+ assert_equal(99, @iteration.stories[0].id)
41
+ assert_equal(101, @iteration.stories[1].id)
42
+ assert_equal(123, @iteration.stories[0].project_id)
43
+ assert_equal(123, @iteration.stories[1].project_id)
44
+ assert_equal("story name", @iteration.stories[0].name)
45
+ assert_equal("another story name", @iteration.stories[1].name)
46
+ end
47
+
48
+ should "have valid story_ids" do
49
+ assert_equal([99, 101], @iteration.story_ids)
50
+ end
51
+
52
+ should "have a valid number" do
53
+ assert_equal(54, @iteration.number)
54
+ end
55
+
56
+ should "have a valid team_strength" do
57
+ assert_equal(0.75, @iteration.team_strength)
58
+ end
59
+
60
+ should "have a valid finish date string" do
61
+ assert_equal("some-finish-date", @iteration.finish)
62
+ end
63
+
64
+ should "have a valid start date string" do
65
+ assert_equal("some-start-date", @iteration.start)
66
+ end
67
+
68
+ should "have a valid kind" do
69
+ assert_equal("iteration", @iteration.kind)
70
+ end
71
+
72
+ end
73
+
74
+ context "An array of PitvotalAPI::Iteration's" do
75
+
76
+ setup do
77
+ @iteration = PivotalAPI::Iterations.from_json([{
78
+ project_id: 123,
79
+ stories: [{
80
+ id: 99,
81
+ url: "http://www.url.com",
82
+ project_id: 123,
83
+ name: "story name",
84
+ description: "story description",
85
+ # other fields purposely left out - they are tested in test_story.rb
86
+ },
87
+ {
88
+ id: 101,
89
+ url: "http://www.urltwo.com",
90
+ project_id: 123,
91
+ name: "another story name",
92
+ description: "another story description",
93
+ # other fields purposely left out - they are tested in test_story.rb
94
+ }],
95
+ story_ids: [99, 101],
96
+ number: 54,
97
+ team_strength: 0.75,
98
+ finish: "some-finish-date",
99
+ kind: "iteration",
100
+ start: "some-start-date"
101
+ },
102
+ {
103
+ project_id: 123,
104
+ stories: [{
105
+ id: 104,
106
+ url: "http://www.urlthree.com",
107
+ project_id: 123,
108
+ name: "story name three",
109
+ description: "story description five",
110
+ # other fields purposely left out - they are tested in test_story.rb
111
+ },
112
+ {
113
+ id: 105,
114
+ url: "http://www.urlfour.com",
115
+ project_id: 123,
116
+ name: "story name four",
117
+ description: "story description four",
118
+ # other fields purposely left out - they are tested in test_story.rb
119
+ }],
120
+ story_ids: [104, 105],
121
+ number: 54,
122
+ team_strength: 0.97,
123
+ finish: "some-finish-date-two",
124
+ kind: "iteration",
125
+ start: "some-start-date-two"
126
+ }])
127
+ end
128
+
129
+ should "have a valid project id" do
130
+ assert_equal(123, @iteration[0].project_id)
131
+
132
+ assert_equal(123, @iteration[1].project_id)
133
+ end
134
+
135
+ should "have valid stories" do
136
+ assert_equal(2, @iteration[0].stories.count)
137
+ assert_equal(99, @iteration[0].stories[0].id)
138
+ assert_equal(123, @iteration[0].stories[0].project_id)
139
+
140
+ assert_equal(2, @iteration[1].stories.count)
141
+ assert_equal(104, @iteration[1].stories[0].id)
142
+ assert_equal(123, @iteration[1].stories[0].project_id)
143
+ end
144
+
145
+ should "have valid story_ids" do
146
+ assert_equal([99, 101], @iteration[0].story_ids)
147
+
148
+ assert_equal([104, 105], @iteration[1].story_ids)
149
+ end
150
+
151
+ should "have a valid number" do
152
+ assert_equal(54, @iteration[0].number)
153
+
154
+ assert_equal(54, @iteration[1].number)
155
+ end
156
+
157
+ should "have a valid team_strength" do
158
+ assert_equal(0.75, @iteration[0].team_strength)
159
+
160
+ assert_equal(0.97, @iteration[1].team_strength)
161
+ end
162
+
163
+ should "have a valid finish date string" do
164
+ assert_equal("some-finish-date", @iteration[0].finish)
165
+
166
+ assert_equal("some-finish-date-two", @iteration[1].finish)
167
+ end
168
+
169
+ should "have a valid start date string" do
170
+ assert_equal("some-start-date", @iteration[0].start)
171
+
172
+ assert_equal("some-start-date-two", @iteration[1].start)
173
+ end
174
+
175
+ should "have a valid kind" do
176
+ assert_equal("iteration", @iteration[0].kind)
177
+
178
+ assert_equal("iteration", @iteration[1].kind)
179
+ end
180
+
181
+ end
182
+ end
@@ -0,0 +1,29 @@
1
+ require 'helper'
2
+
3
+ class TestLabel < Test::Unit::TestCase
4
+
5
+ context "A PivotalAPI::Label" do
6
+
7
+ setup do
8
+ @label = PivotalAPI::Label.from_json({
9
+ id: 1,
10
+ project_id: 2,
11
+ name: "some-label",
12
+ created_at: "2016-08-09T18:55:58Z",
13
+ updated_at: "2016-08-09T18:55:58Z",
14
+ counts: 4,
15
+ kind: "some-kind"
16
+ })
17
+ end
18
+
19
+ should "should have valid attributes" do
20
+ assert_equal(1, @label.id)
21
+ assert_equal(2, @label.project_id)
22
+ assert_equal("some-label", @label.name)
23
+ assert_equal(DateTime.parse("2016-08-09T18:55:58Z"), @label.created_at)
24
+ assert_equal(DateTime.parse("2016-08-09T18:55:58Z"), @label.updated_at)
25
+ assert_equal(4, @label.counts)
26
+ assert_equal("some-kind", @label.kind)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,52 @@
1
+ require 'helper'
2
+
3
+ class TestMe < Test::Unit::TestCase
4
+
5
+ context "A PivotalAPI::Me" do
6
+
7
+ setup do
8
+ @me = PivotalAPI::Me.from_json({
9
+ api_token: "VadersToken",
10
+ created_at: "2016-08-09T12:00:05Z",
11
+ email: "vader@deathstar.mil",
12
+ has_google_identity: false,
13
+ id: 101,
14
+ initials: "DV",
15
+ kind: "me",
16
+ name: "Darth Vader",
17
+ projects: [{
18
+ kind: "membership_summary",
19
+ id: 108,
20
+ project_id: 98,
21
+ project_name: "Learn About the Force",
22
+ project_color: "8100ea",
23
+ role: "owner",
24
+ last_viewed_at: "2016-08-09T12:00:00Z"
25
+ },
26
+ {
27
+ kind: "membership_summary",
28
+ id: 101,
29
+ project_id: 99,
30
+ project_name: "Death Star",
31
+ project_color: "8100ea",
32
+ role: "member",
33
+ last_viewed_at: "2016-08-09T12:00:00Z"
34
+ }],
35
+ receives_in_app_notifications: true,
36
+ time_zone:
37
+ {
38
+ kind: "time_zone",
39
+ olson_name: "America/Los_Angeles",
40
+ offset: "-08:00"
41
+ },
42
+ updated_at: "2016-08-09T12:00:10Z",
43
+ username: "vader"
44
+ })
45
+ end
46
+
47
+ should "have a valid id" do
48
+ assert_equal("VadersToken", @me.api_token)
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,67 @@
1
+ require 'helper'
2
+
3
+ class TestService < Test::Unit::TestCase
4
+
5
+ context "PivotalAPI::Service" do
6
+
7
+ # setup do
8
+ # PivotalAPI::Service.set_token "TOKEN_HERE"
9
+ # end
10
+
11
+ # should "get user info" do
12
+ # me = PivotalAPI::Me.retrieve('USERNAME', 'PASSWORD')
13
+ # assert_not_nil(me)
14
+ # assert_not_nil(me.api_token)
15
+ # end
16
+
17
+ # should "should get project, iteration, and stories" do
18
+ # project = PivotalAPI::Project.retrieve(1158374)
19
+ # iteration = project.iterations.first
20
+ # iteration.stories.each do |story|
21
+ # puts "------------------"
22
+ # puts "Story: #{story.name} - status: #{story.current_state} - overdue: #{story.overdue?}"
23
+ # puts "------------------"
24
+ # end
25
+ #
26
+ # assert_not_nil(iteration)
27
+ # assert_not_nil(iteration.stories)
28
+ # end
29
+
30
+ # should "should get project and stories" do
31
+ # project = PivotalAPI::Project.retrieve(1158374)
32
+ # stories = project.stories()
33
+ # stories.each do |story|
34
+ # puts "------------------"
35
+ # puts "Story: #{story.name} - status: #{story.current_state} - overdue: #{story.overdue?}"
36
+ # puts "------------------"
37
+ # end
38
+ #
39
+ # assert_not_nil(stories)
40
+ # end
41
+
42
+ # should "should get projects" do
43
+ # project = PivotalAPI::Projects.retrieve()
44
+ # project.each do |project|
45
+ # puts "------------------"
46
+ # puts "Project: #{project.name}"
47
+ # puts "------------------"
48
+ # end
49
+ #
50
+ # assert_not_nil(project)
51
+ # end
52
+
53
+ # should "should get project activity" do
54
+ # project = PivotalAPI::Project.retrieve(1158374)
55
+ # activity = project.activity
56
+ # activity.each do |a|
57
+ # puts "------------------"
58
+ # puts "Activity: #{a}"
59
+ # puts "------------------"
60
+ # end
61
+ #
62
+ # assert_not_nil(activity)
63
+ # end
64
+
65
+ end
66
+
67
+ end
@@ -0,0 +1,557 @@
1
+ require 'helper'
2
+
3
+ class TestActivity < Test::Unit::TestCase
4
+
5
+ context "A PivotalAPI::Story" do
6
+
7
+ setup do
8
+ @story = PivotalAPI::Story.from_json({
9
+ id: 1,
10
+ url: "http://www.url.com",
11
+ project_id: 123,
12
+ name: "story name",
13
+ description: "story description",
14
+ story_type: "feature",
15
+ estimate: 13,
16
+ current_state: "accepted",
17
+ created_at: "2016-08-17T11:03:53-04:00",
18
+ updated_at: "2016-08-17T11:03:53-04:00",
19
+ kind: "story",
20
+ integration_id: 5,
21
+ deadline: "2016-08-17T11:03:53-04:00",
22
+ external_id: 222,
23
+ accepted_at: "2016-08-19T11:03:53-04:00",
24
+ task_ids: [432],
25
+ tasks: [{
26
+ project_id: 123,
27
+ story_id: 1,
28
+ id: 432,
29
+ description: "task description",
30
+ position: 1,
31
+ complete: false,
32
+ created_at: "2016-08-17T11:03:53-04:00"
33
+ }],
34
+ comment_ids: [63],
35
+ comments: [{
36
+ project_id: 123,
37
+ story_id: 1,
38
+ epic_id: 88,
39
+ id: 63,
40
+ text: "some comment text",
41
+ person: {
42
+ id: 99,
43
+ name: "Gary Appleseed",
44
+ initials: "GA",
45
+ email: "gary@email.com",
46
+ username: "garyapple"
47
+ },
48
+ created_at: "2016-08-17T11:03:53-04:00",
49
+ updated_at: "2016-08-17T11:03:53-04:00",
50
+ file_attachments: [{
51
+ filename: "filename.jpg",
52
+ id: 333,
53
+ created_at: "2016-08-09T18:55:58Z",
54
+ uploaded_by: {
55
+ id: 99,
56
+ name: "Gary Appleseed",
57
+ initials: "GA",
58
+ email: "gary@email.com",
59
+ username: "garyapple"
60
+ },
61
+ big_url: "http://www.bigurl.com",
62
+ width: 300,
63
+ height: 450,
64
+ download_url: "http://www.downloadurl.com",
65
+ thumbnail_url: "http://www.thumbnailurl.com",
66
+ size: 1598,
67
+ content_type: "image/jpeg"
68
+ }],
69
+ google_attachment_ids: [45, 97, 105],
70
+ commit_identifier: "271921wuwwui2u3uewweiweed3e",
71
+ commit_type: "github",
72
+ kind: "comment"
73
+ }],
74
+ requested_by_id: 2,
75
+ requested_by: {
76
+ id: 2,
77
+ name: "Mike Appleseed",
78
+ initials: "MA",
79
+ email: "mike@email.com",
80
+ username: "mikeapple"
81
+ },
82
+ owner_ids: [3, 4],
83
+ owners: [{
84
+ id: 3,
85
+ name: "John Appleseed",
86
+ initials: "JA",
87
+ email: "john@email.com",
88
+ username: "johnapple"
89
+ },
90
+ {
91
+ id: 4,
92
+ name: "Sam Appleseed",
93
+ initials: "SA",
94
+ email: "sam@email.com",
95
+ username: "sameapple"
96
+ }],
97
+ follower_ids: [2, 3, 4],
98
+ followers: [{
99
+ id: 2,
100
+ name: "Mike Appleseed",
101
+ initials: "MA",
102
+ email: "mike@email.com",
103
+ username: "mikeapple"
104
+ },
105
+ {
106
+ id: 3,
107
+ name: "John Appleseed",
108
+ initials: "JA",
109
+ email: "john@email.com",
110
+ username: "johnapple"
111
+ },
112
+ {
113
+ id: 4,
114
+ name: "Sam Appleseed",
115
+ initials: "SA",
116
+ email: "sam@email.com",
117
+ username: "sameapple"
118
+ }],
119
+ label_ids: [20, 30],
120
+ labels: [{
121
+ id: 20,
122
+ name: "label-one",
123
+ project_id: 123,
124
+ created_at: "2016-08-17T11:03:53-04:00",
125
+ updated_at: "2016-08-17T11:03:53-04:00",
126
+ counts: 3,
127
+ kind: "label"
128
+ },
129
+ {
130
+ id: 30,
131
+ name: "label-two",
132
+ project_id: 123,
133
+ created_at: "2016-08-17T11:03:53-04:00",
134
+ updated_at: "2016-08-17T11:03:53-04:00",
135
+ counts: 4,
136
+ kind: "label"
137
+ }],
138
+ transitions: [{
139
+ state: "started",
140
+ story_id: 1,
141
+ project_id: 2,
142
+ project_version: 3,
143
+ occurred_at: "2016-08-17T11:03:53-04:00",
144
+ performed_by_id: 4,
145
+ kind: "some-kind"
146
+ },
147
+ {
148
+ state: "finished",
149
+ story_id: 1,
150
+ project_id: 2,
151
+ project_version: 3,
152
+ occurred_at: "2016-08-19T11:03:53-04:00",
153
+ performed_by_id: 4,
154
+ kind: "some-kind"
155
+ },
156
+ {
157
+ state: "accepted",
158
+ story_id: 1,
159
+ project_id: 2,
160
+ project_version: 3,
161
+ occurred_at: "2016-08-19T11:03:53-04:00",
162
+ performed_by_id: 4,
163
+ kind: "some-kind"
164
+ }]
165
+ })
166
+ end
167
+
168
+ should "have a valid id" do
169
+ assert_equal(1, @story.id)
170
+ end
171
+
172
+ should "have a valid project_id" do
173
+ assert_equal(123, @story.project_id)
174
+ end
175
+
176
+ should "have a valid url" do
177
+ assert_equal("http://www.url.com", @story.url)
178
+ end
179
+
180
+ should "have a valid name" do
181
+ assert_equal("story name", @story.name)
182
+ end
183
+
184
+ should "have a valid description" do
185
+ assert_equal("story description", @story.description)
186
+ end
187
+
188
+ should "have a valid story_type" do
189
+ assert_equal("feature", @story.story_type)
190
+ end
191
+
192
+ should "have a valid estimate" do
193
+ assert_equal(13, @story.estimate)
194
+ end
195
+
196
+ should "have accurately determined if story is overdue?" do
197
+ assert_equal(true, @story.overdue?)
198
+ @story.estimate = 40
199
+ assert_equal(false, @story.overdue?)
200
+ end
201
+
202
+ should "have a valid current_state" do
203
+ assert_equal("accepted", @story.current_state)
204
+ end
205
+
206
+ should "have a valid created_at date" do
207
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.created_at)
208
+ end
209
+
210
+ should "have a valid updated_at date" do
211
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.updated_at)
212
+ end
213
+
214
+ should "have a valid kind" do
215
+ assert_equal("story", @story.kind)
216
+ end
217
+
218
+ should "have a valid integration_id" do
219
+ assert_equal(5, @story.integration_id)
220
+ end
221
+
222
+ should "have a valid deadline date" do
223
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.deadline)
224
+ end
225
+
226
+ should "have a valid external_id" do
227
+ assert_equal(222, @story.external_id)
228
+ end
229
+
230
+ should "have a valid accepted_at date" do
231
+ assert_equal(DateTime.parse("2016-08-19T11:03:53-04:00"), @story.accepted_at)
232
+ end
233
+
234
+ should "have a valid requested_by_id" do
235
+ assert_equal(2, @story.requested_by_id)
236
+ end
237
+
238
+ should "have a valid requested_by person" do
239
+ assert_equal("Mike Appleseed", @story.requested_by.name)
240
+ end
241
+
242
+ should "have a valid owner_ids" do
243
+ assert_equal([3, 4], @story.owner_ids)
244
+ end
245
+
246
+ should "have valid owners" do
247
+ assert_equal("John Appleseed", @story.owners[0].name)
248
+ assert_equal("Sam Appleseed", @story.owners[1].name)
249
+ end
250
+
251
+ should "have a valid comment_ids" do
252
+ assert_equal([63], @story.comment_ids)
253
+ end
254
+
255
+ should "have valid comments" do
256
+ assert_equal("some comment text", @story.comments[0].text)
257
+ end
258
+
259
+ should "have a valid follower_ids" do
260
+ assert_equal([2, 3, 4], @story.follower_ids)
261
+ end
262
+
263
+ should "have valid followers" do
264
+ assert_equal("Mike Appleseed", @story.followers[0].name)
265
+ assert_equal("John Appleseed", @story.followers[1].name)
266
+ assert_equal("Sam Appleseed", @story.followers[2].name)
267
+ end
268
+
269
+ should "have a valid label_ids" do
270
+ assert_equal([20, 30], @story.label_ids)
271
+ end
272
+
273
+ should "have valid labels" do
274
+ assert_equal("label-one", @story.labels[0].name)
275
+ assert_equal("label-two", @story.labels[1].name)
276
+ end
277
+
278
+ should "have valid transitions" do
279
+ assert_equal("started", @story.transitions[0].state)
280
+ end
281
+
282
+ should "have a valid task_ids" do
283
+ assert_equal([432], @story.task_ids)
284
+ end
285
+
286
+ should "have valid tasks" do
287
+ assert_equal("task description", @story.tasks[0].description)
288
+ end
289
+
290
+ end
291
+
292
+
293
+ context "An array of PivotalAPI::Story's" do
294
+
295
+ setup do
296
+ stories = PivotalAPI::Stories.from_json([{
297
+ id: 1,
298
+ url: "http://www.url.com",
299
+ project_id: 123,
300
+ name: "story name",
301
+ description: "story description",
302
+ story_type: "feature",
303
+ estimate: 13,
304
+ current_state: "started",
305
+ created_at: "2016-08-17T11:03:53-04:00",
306
+ updated_at: "2016-08-17T11:03:53-04:00",
307
+ kind: "story",
308
+ integration_id: 5,
309
+ deadline: "2016-08-17T11:03:53-04:00",
310
+ external_id: 222,
311
+ accepted_at: "2016-08-17T11:03:53-04:00",
312
+ task_ids: [432],
313
+ tasks: [{
314
+ project_id: 123,
315
+ story_id: 1,
316
+ id: 432,
317
+ description: "task description",
318
+ position: 1,
319
+ complete: false,
320
+ created_at: "2016-08-17T11:03:53-04:00"
321
+ }],
322
+ comment_ids: [63],
323
+ comments: [{
324
+ project_id: 123,
325
+ story_id: 1,
326
+ epic_id: 88,
327
+ id: 63,
328
+ text: "some comment text",
329
+ person: {
330
+ id: 99,
331
+ name: "Gary Appleseed",
332
+ initials: "GA",
333
+ email: "gary@email.com",
334
+ username: "garyapple"
335
+ },
336
+ created_at: "2016-08-17T11:03:53-04:00",
337
+ updated_at: "2016-08-17T11:03:53-04:00",
338
+ file_attachments: [{
339
+ filename: "filename.jpg",
340
+ id: 333,
341
+ created_at: "2016-08-09T18:55:58Z",
342
+ uploaded_by: {
343
+ id: 99,
344
+ name: "Gary Appleseed",
345
+ initials: "GA",
346
+ email: "gary@email.com",
347
+ username: "garyapple"
348
+ },
349
+ big_url: "http://www.bigurl.com",
350
+ width: 300,
351
+ height: 450,
352
+ download_url: "http://www.downloadurl.com",
353
+ thumbnail_url: "http://www.thumbnailurl.com",
354
+ size: 1598,
355
+ content_type: "image/jpeg"
356
+ }],
357
+ google_attachment_ids: [45, 97, 105],
358
+ commit_identifier: "271921wuwwui2u3uewweiweed3e",
359
+ commit_type: "github",
360
+ kind: "comment"
361
+ }],
362
+ requested_by_id: 2,
363
+ requested_by: {
364
+ id: 2,
365
+ name: "Mike Appleseed",
366
+ initials: "MA",
367
+ email: "mike@email.com",
368
+ username: "mikeapple"
369
+ },
370
+ owner_ids: [3, 4],
371
+ owners: [{
372
+ id: 3,
373
+ name: "John Appleseed",
374
+ initials: "JA",
375
+ email: "john@email.com",
376
+ username: "johnapple"
377
+ },
378
+ {
379
+ id: 4,
380
+ name: "Sam Appleseed",
381
+ initials: "SA",
382
+ email: "sam@email.com",
383
+ username: "sameapple"
384
+ }],
385
+ follower_ids: [2, 3, 4],
386
+ followers: [{
387
+ id: 2,
388
+ name: "Mike Appleseed",
389
+ initials: "MA",
390
+ email: "mike@email.com",
391
+ username: "mikeapple"
392
+ },
393
+ {
394
+ id: 3,
395
+ name: "John Appleseed",
396
+ initials: "JA",
397
+ email: "john@email.com",
398
+ username: "johnapple"
399
+ },
400
+ {
401
+ id: 4,
402
+ name: "Sam Appleseed",
403
+ initials: "SA",
404
+ email: "sam@email.com",
405
+ username: "sameapple"
406
+ }],
407
+ label_ids: [20, 30],
408
+ labels: [{
409
+ id: 20,
410
+ name: "label-one",
411
+ project_id: 123,
412
+ created_at: "2016-08-17T11:03:53-04:00",
413
+ updated_at: "2016-08-17T11:03:53-04:00",
414
+ counts: 3,
415
+ kind: "label"
416
+ },
417
+ {
418
+ id: 30,
419
+ name: "label-two",
420
+ project_id: 123,
421
+ created_at: "2016-08-17T11:03:53-04:00",
422
+ updated_at: "2016-08-17T11:03:53-04:00",
423
+ counts: 4,
424
+ kind: "label"
425
+ }],
426
+ transitions: [{
427
+ state: "started",
428
+ story_id: 1,
429
+ project_id: 2,
430
+ project_version: 3,
431
+ occurred_at: "2016-08-17T11:03:53-04:00",
432
+ performed_by_id: 4,
433
+ kind: "some-kind"
434
+ }]
435
+ }])
436
+
437
+ @story = stories[0]
438
+ end
439
+
440
+ should "have a valid id" do
441
+ assert_equal(1, @story.id)
442
+ end
443
+
444
+ should "have a valid project_id" do
445
+ assert_equal(123, @story.project_id)
446
+ end
447
+
448
+ should "have a valid url" do
449
+ assert_equal("http://www.url.com", @story.url)
450
+ end
451
+
452
+ should "have a valid name" do
453
+ assert_equal("story name", @story.name)
454
+ end
455
+
456
+ should "have a valid description" do
457
+ assert_equal("story description", @story.description)
458
+ end
459
+
460
+ should "have a valid story_type" do
461
+ assert_equal("feature", @story.story_type)
462
+ end
463
+
464
+ should "have a valid estimate" do
465
+ assert_equal(13, @story.estimate)
466
+ end
467
+
468
+ should "have a valid current_state" do
469
+ assert_equal("started", @story.current_state)
470
+ end
471
+
472
+ should "have a valid created_at date" do
473
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.created_at)
474
+ end
475
+
476
+ should "have a valid updated_at date" do
477
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.updated_at)
478
+ end
479
+
480
+ should "have a valid kind" do
481
+ assert_equal("story", @story.kind)
482
+ end
483
+
484
+ should "have a valid integration_id" do
485
+ assert_equal(5, @story.integration_id)
486
+ end
487
+
488
+ should "have a valid deadline date" do
489
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.deadline)
490
+ end
491
+
492
+ should "have a valid external_id" do
493
+ assert_equal(222, @story.external_id)
494
+ end
495
+
496
+ should "have a valid accepted_at date" do
497
+ assert_equal(DateTime.parse("2016-08-17T11:03:53-04:00"), @story.accepted_at)
498
+ end
499
+
500
+ should "have a valid requested_by_id" do
501
+ assert_equal(2, @story.requested_by_id)
502
+ end
503
+
504
+ should "have a valid requested_by person" do
505
+ assert_equal("Mike Appleseed", @story.requested_by.name)
506
+ end
507
+
508
+ should "have a valid owner_ids" do
509
+ assert_equal([3, 4], @story.owner_ids)
510
+ end
511
+
512
+ should "have valid owners" do
513
+ assert_equal("John Appleseed", @story.owners[0].name)
514
+ assert_equal("Sam Appleseed", @story.owners[1].name)
515
+ end
516
+
517
+ should "have a valid comment_ids" do
518
+ assert_equal([63], @story.comment_ids)
519
+ end
520
+
521
+ should "have valid comments" do
522
+ assert_equal("some comment text", @story.comments[0].text)
523
+ end
524
+
525
+ should "have a valid follower_ids" do
526
+ assert_equal([2, 3, 4], @story.follower_ids)
527
+ end
528
+
529
+ should "have valid followers" do
530
+ assert_equal("Mike Appleseed", @story.followers[0].name)
531
+ assert_equal("John Appleseed", @story.followers[1].name)
532
+ assert_equal("Sam Appleseed", @story.followers[2].name)
533
+ end
534
+
535
+ should "have a valid label_ids" do
536
+ assert_equal([20, 30], @story.label_ids)
537
+ end
538
+
539
+ should "have valid labels" do
540
+ assert_equal("label-one", @story.labels[0].name)
541
+ assert_equal("label-two", @story.labels[1].name)
542
+ end
543
+
544
+ should "have valid transitions" do
545
+ assert_equal("started", @story.transitions[0].state)
546
+ end
547
+
548
+ should "have a valid task_ids" do
549
+ assert_equal([432], @story.task_ids)
550
+ end
551
+
552
+ should "have valid tasks" do
553
+ assert_equal("task description", @story.tasks[0].description)
554
+ end
555
+
556
+ end
557
+ end