troo 0.0.9 → 0.0.10

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 (137) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/Gemfile.lock +40 -32
  4. data/Guardfile +9 -1
  5. data/README.md +15 -10
  6. data/bin/troo +22 -2
  7. data/config/en.yml +11 -1
  8. data/config/help +16 -0
  9. data/{.trooconf.example → config/trooconf.yml} +4 -2
  10. data/features/add/card.feature +1 -1
  11. data/features/add/comment.feature +1 -1
  12. data/features/add/list.feature +1 -1
  13. data/features/default/board.feature +1 -1
  14. data/features/default/card.feature +1 -1
  15. data/features/default/list.feature +1 -1
  16. data/features/move/card.feature +5 -5
  17. data/features/refresh/board.feature +1 -1
  18. data/features/refresh/card.feature +1 -1
  19. data/features/refresh/list.feature +1 -1
  20. data/features/show/board.feature +11 -3
  21. data/features/show/boards.feature +1 -0
  22. data/features/show/card.feature +7 -7
  23. data/features/show/comment.feature +15 -6
  24. data/features/show/list.feature +3 -1
  25. data/features/status.feature +2 -2
  26. data/features/step_definitions/fabrication_steps.rb +11 -11
  27. data/features/step_definitions/troo_steps.rb +1 -1
  28. data/features/support/cassettes/200_board_by_id.yml +56 -0
  29. data/features/support/cassettes/200_card_by_id.yml +77 -0
  30. data/features/support/cassettes/200_create_board.yml +186 -0
  31. data/features/support/cassettes/200_create_card.yml +86 -0
  32. data/features/support/cassettes/200_create_comment.yml +73 -0
  33. data/features/support/cassettes/200_create_list.yml +53 -0
  34. data/{test/cassettes/list_by_id.yml → features/support/cassettes/200_list_by_id.yml} +6 -6
  35. data/features/support/cassettes/200_move_card_200_board.yml +86 -0
  36. data/features/support/cassettes/200_move_card_200_list.yml +86 -0
  37. data/features/support/cassettes/200_move_card_400_list.yml +46 -0
  38. data/{test/cassettes/lists_by_board_id.yml → features/support/cassettes/400_board_by_id.yml} +10 -10
  39. data/features/support/cassettes/400_card_by_id.yml +46 -0
  40. data/features/support/cassettes/400_create_card.yml +46 -0
  41. data/features/support/cassettes/400_create_comment.yml +46 -0
  42. data/features/support/cassettes/400_create_list.yml +46 -0
  43. data/features/support/cassettes/400_list_by_id.yml +46 -0
  44. data/features/support/cassettes/400_move_card_200_list.yml +46 -0
  45. data/features/support/cassettes/400_move_card_400_board.yml +46 -0
  46. data/features/support/cassettes/boards_all.yml +286 -0
  47. data/features/support/env.rb +1 -2
  48. data/lib/troo/cli/commands/refresh/all.rb +2 -0
  49. data/lib/troo/cli/main.rb +2 -23
  50. data/lib/troo/configuration.rb +5 -0
  51. data/lib/troo/database.rb +29 -0
  52. data/lib/troo/decorators/resource.rb +24 -10
  53. data/lib/troo/helpers/model_helpers.rb +3 -2
  54. data/lib/troo/models/board.rb +1 -1
  55. data/lib/troo/models/card.rb +1 -1
  56. data/lib/troo/models/comment.rb +0 -4
  57. data/lib/troo/models/list.rb +1 -1
  58. data/lib/troo/presentation/formatter.rb +99 -4
  59. data/lib/troo/presentation/template.rb +8 -9
  60. data/lib/troo/presenters/board.rb +24 -26
  61. data/lib/troo/presenters/card.rb +3 -1
  62. data/lib/troo/presenters/list.rb +30 -17
  63. data/lib/troo/presenters/resource.rb +90 -0
  64. data/lib/troo/retrieval/local.rb +5 -1
  65. data/lib/troo/troo.rb +2 -0
  66. data/lib/troo/version.rb +1 -1
  67. data/lib/troo.rb +7 -4
  68. data/test/cassettes/create_board.yml +15 -9
  69. data/test/cassettes/create_card.yml +10 -10
  70. data/test/cassettes/create_comment.yml +9 -9
  71. data/test/cassettes/create_list.yml +5 -5
  72. data/test/cassettes/move_card_board.yml +11 -11
  73. data/test/cassettes/move_card_list.yml +11 -11
  74. data/test/lib/troo/api/endpoints_test.rb +2 -2
  75. data/test/lib/troo/cli/commands/add_test.rb +2 -2
  76. data/test/lib/troo/cli/commands/refresh/all_test.rb +4 -9
  77. data/test/lib/troo/cli/main_test.rb +0 -25
  78. data/test/lib/troo/configuration_test.rb +18 -13
  79. data/test/lib/troo/decorators/member_test.rb +0 -27
  80. data/test/lib/troo/decorators/resource_test.rb +0 -32
  81. data/test/lib/troo/helpers/model_helpers_test.rb +15 -3
  82. data/test/lib/troo/models/board_test.rb +45 -1
  83. data/test/lib/troo/models/card_test.rb +60 -6
  84. data/test/lib/troo/models/comment_test.rb +44 -4
  85. data/test/lib/troo/models/database_test.rb +19 -0
  86. data/test/lib/troo/models/list_test.rb +46 -2
  87. data/test/lib/troo/models/member_test.rb +51 -1
  88. data/test/lib/troo/presentation/formatter_test.rb +54 -2
  89. data/test/lib/troo/presentation/template_test.rb +4 -4
  90. data/test/lib/troo/presenters/board_test.rb +4 -3
  91. data/test/lib/troo/presenters/list_test.rb +3 -3
  92. data/test/lib/troo/presenters/member_test.rb +1 -1
  93. data/test/lib/troo/presenters/resource_test.rb +79 -0
  94. data/test/lib/troo/remote/board_test.rb +5 -8
  95. data/test/lib/troo/remote/card_test.rb +7 -11
  96. data/test/lib/troo/remote/comment_test.rb +10 -14
  97. data/test/lib/troo/remote/list_test.rb +5 -9
  98. data/test/lib/troo/remote/member_test.rb +5 -9
  99. data/test/lib/troo/remote/persistence/card_test.rb +1 -1
  100. data/test/lib/troo/remote/persistence/comment_test.rb +1 -1
  101. data/test/lib/troo/remote/persistence/list_test.rb +1 -1
  102. data/test/lib/troo/remote/persistence/move_card_test.rb +3 -3
  103. data/test/lib/troo/retrieval/local_test.rb +13 -1
  104. data/test/lib/troo/retrieval/remote_test.rb +1 -1
  105. data/test/support/fabrication.rb +12 -12
  106. data/test/support/fake_trello/fake_response.rb +18 -1
  107. data/test/support/fake_trello/server.rb +2 -0
  108. data/test/support/remotes/all_boards.json +103 -4
  109. data/test/support/remotes/{board.json → all_boards_200.json} +13 -13
  110. data/test/support/remotes/board_200.json +140 -0
  111. data/test/support/remotes/board_by_id.json +9 -9
  112. data/test/support/remotes/board_by_id_200.json +75 -0
  113. data/test/support/remotes/card.json +4 -4
  114. data/test/support/remotes/card_200.json +40 -0
  115. data/test/support/remotes/card_by_card_id.json +64 -64
  116. data/test/support/remotes/card_by_card_id_200.json +302 -0
  117. data/test/support/remotes/comment.json +6 -6
  118. data/test/support/remotes/comment_200.json +27 -0
  119. data/test/support/remotes/create_board.json +1 -1
  120. data/test/support/remotes/create_board_200.json +38 -0
  121. data/test/support/remotes/list.json +2 -2
  122. data/test/support/remotes/list_200.json +7 -0
  123. data/test/support/remotes/member.json +4 -4
  124. data/test/support/remotes/member_200.json +50 -0
  125. data/test/test_helper.rb +9 -2
  126. data/troo.gemspec +4 -3
  127. metadata +92 -41
  128. data/test/cassettes/board_by_id.yml +0 -50
  129. data/test/cassettes/boards_all.yml +0 -50
  130. data/test/cassettes/card_by_id.yml +0 -49
  131. data/test/cassettes/cards_by_board_id.yml +0 -49
  132. data/test/cassettes/cards_by_list_id.yml +0 -49
  133. data/test/cassettes/comments_by_board_id.yml +0 -49
  134. data/test/cassettes/comments_by_card_id.yml +0 -49
  135. data/test/cassettes/member_by_id.yml +0 -48
  136. data/test/cassettes/members_by_board_id.yml +0 -48
  137. data/test/lib/troo/decorators/card_test.rb +0 -113
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/boards/526d8e130a14a9d846001d96/cards
6
- body:
7
- encoding: UTF-8
8
- string: filter=open
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '11'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '864'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "[{\"id\":\"526d8f19ddb279532e005259\",\"badges\":{\"votes\":0,\"viewingMemberVoted\":false,\"subscribed\":false,\"fogbugz\":\"\",\"checkItems\":0,\"checkItemsChecked\":0,\"comments\":10,\"attachments\":0,\"description\":false,\"due\":null},\"checkItemStates\":[],\"closed\":false,\"dateLastActivity\":\"2014-02-13T20:12:46.612Z\",\"desc\":\"some
44
- description\",\"descData\":null,\"due\":null,\"idBoard\":\"526d8e130a14a9d846001d96\",\"idChecklists\":[],\"idList\":\"526d8e130a14a9d846001d98\",\"idMembers\":[\"5195fdb5a8c01a2318004f5d\"],\"idShort\":67,\"idAttachmentCover\":null,\"manualCoverAttachment\":false,\"labels\":[{\"color\":\"green\",\"name\":\"Ready
45
- to Pull\"}],\"name\":\"My Test Card\",\"pos\":589823,\"shortUrl\":\"<Trello
46
- URL>\",\"url\":\"<Trello URL>\"}]"
47
- http_version:
48
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
49
- recorded_with: VCR 2.8.0
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/lists/526d8e130a14a9d846001d97/cards
6
- body:
7
- encoding: UTF-8
8
- string: filter=open
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '11'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '864'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "[{\"id\":\"526d8f19ddb279532e005259\",\"badges\":{\"votes\":0,\"viewingMemberVoted\":false,\"subscribed\":false,\"fogbugz\":\"\",\"checkItems\":0,\"checkItemsChecked\":0,\"comments\":10,\"attachments\":0,\"description\":false,\"due\":null},\"checkItemStates\":[],\"closed\":false,\"dateLastActivity\":\"2014-02-13T20:12:46.612Z\",\"desc\":\"some
44
- description\",\"descData\":null,\"due\":null,\"idBoard\":\"526d8e130a14a9d846001d96\",\"idChecklists\":[],\"idList\":\"526d8e130a14a9d846001d98\",\"idMembers\":[\"5195fdb5a8c01a2318004f5d\"],\"idShort\":67,\"idAttachmentCover\":null,\"manualCoverAttachment\":false,\"labels\":[{\"color\":\"green\",\"name\":\"Ready
45
- to Pull\"}],\"name\":\"My Test Card\",\"pos\":589823,\"shortUrl\":\"<Trello
46
- URL>\",\"url\":\"<Trello URL>\"}]"
47
- http_version:
48
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
49
- recorded_with: VCR 2.8.0
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/boards/526d8e130a14a9d846001d96/actions
6
- body:
7
- encoding: UTF-8
8
- string: filter=commentCard
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '18'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '665'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "{\"id\":\"51f9277b2822b8654f0023af\",\"idMemberCreator\":\"5195fdb5a8c01a2318004f5d\",\"data\":{\"board\":{\"shortLink\":\"a3RnYKnD\",\"name\":\"My
44
- Test Board\",\"id\":\"526d8e130a14a9d846001d96\"},\"card\":{\"shortLink\":\"UJBK7pil\",\"idShort\":8,\"name\":\"My
45
- Test Card\",\"id\":\"526d8f19ddb279532e005259\"},\"text\":\"My Test Comment\"},\"type\":\"commentCard\",\"date\":\"2014-02-07T18:02:24.297Z\",\"memberCreator\":{\"id\":\"5195fdb5a8c01a2318004f5d\",\"avatarHash\":\"045fd924d84699c9ba451e181bba33a3\",\"fullName\":\"Gavin
46
- Laking\",\"initials\":\"GL\",\"username\":\"gavinlaking1\"}}"
47
- http_version:
48
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
49
- recorded_with: VCR 2.8.0
@@ -1,49 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/cards/526d8f19ddb279532e005259/actions
6
- body:
7
- encoding: UTF-8
8
- string: filter=commentCard
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '18'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '665'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "{\"id\":\"51f9277b2822b8654f0023af\",\"idMemberCreator\":\"5195fdb5a8c01a2318004f5d\",\"data\":{\"board\":{\"shortLink\":\"a3RnYKnD\",\"name\":\"My
44
- Test Board\",\"id\":\"526d8e130a14a9d846001d96\"},\"card\":{\"shortLink\":\"UJBK7pil\",\"idShort\":8,\"name\":\"My
45
- Test Card\",\"id\":\"526d8f19ddb279532e005259\"},\"text\":\"My Test Comment\"},\"type\":\"commentCard\",\"date\":\"2014-02-07T18:02:24.297Z\",\"memberCreator\":{\"id\":\"5195fdb5a8c01a2318004f5d\",\"avatarHash\":\"045fd924d84699c9ba451e181bba33a3\",\"fullName\":\"Gavin
46
- Laking\",\"initials\":\"GL\",\"username\":\"gavinlaking1\"}}"
47
- http_version:
48
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
49
- recorded_with: VCR 2.8.0
@@ -1,48 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/members/5195fdb5a8c01a2318004f5d
6
- body:
7
- encoding: ASCII-8BIT
8
- string: ''
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '0'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '1189'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "{\"id\":\"5195fdb5a8c01a2318004f5d\",\"avatarHash\":\"045fd924d84699c9ba451e181bba33a3\",\"bio\":\"some
44
- bio\",\"bioData\":null,\"confirmed\":true,\"fullName\":\"Gavin Laking\",\"idPremOrgsAdmin\":[],\"initials\":\"GL\",\"memberType\":\"normal\",\"products\":[],\"status\":\"disconnected\",\"url\":\"<Trello
45
- URL>\",\"username\":\"gavinlaking1\",\"avatarSource\":\"gravatar\",\"email\":\"gavinlaking@gmail.com\",\"gravatarHash\":\"c9c47875936bed67032a12c047b468a8\",\"idBoards\":[\"526d8e130a14a9d846001d96\"],\"idBoardsInvited\":[],\"idBoardsPinned\":[\"526d8e130a14a9d846001d96\"],\"idOrganizations\":[],\"idOrganizationsInvited\":[],\"loginTypes\":null,\"newEmail\":null,\"oneTimeMessagesDismissed\":[\"newtrelloIntro\"],\"prefs\":{\"timezoneInfo\":{\"timezoneNext\":\"BST\",\"dateNext\":\"2014-03-30T01:00:00.000Z\",\"offsetNext\":-60,\"timezoneCurrent\":\"GMT\",\"offsetCurrent\":0},\"sendSummaries\":true,\"minutesBetweenSummaries\":60,\"minutesBeforeDeadlineToNotify\":1440,\"colorBlind\":false},\"trophies\":[\"Android\"],\"uploadedAvatarHash\":null,\"premiumFeatures\":[]}"
46
- http_version:
47
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
48
- recorded_with: VCR 2.8.0
@@ -1,48 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.trello.com/1/boards/526d8e130a14a9d846001d96/members
6
- body:
7
- encoding: UTF-8
8
- string: filter=all
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Authorization:
15
- - "<OAuth Credentials>"
16
- Content-Length:
17
- - '10'
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: 'OK '
24
- headers:
25
- Content-Type:
26
- - text/html;charset=utf-8
27
- Content-Length:
28
- - '1191'
29
- X-Xss-Protection:
30
- - 1; mode=block
31
- X-Content-Type-Options:
32
- - nosniff
33
- X-Frame-Options:
34
- - SAMEORIGIN
35
- Server:
36
- - WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) OpenSSL/1.0.1e
37
- Date:
38
- - Fri, 21 Feb 2014 19:12:14 GMT
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: UTF-8
43
- string: "[{\"id\":\"5195fdb5a8c01a2318004f5d\",\"avatarHash\":\"045fd924d84699c9ba451e181bba33a3\",\"bio\":\"some
44
- bio\",\"bioData\":null,\"confirmed\":true,\"fullName\":\"Gavin Laking\",\"idPremOrgsAdmin\":[],\"initials\":\"GL\",\"memberType\":\"normal\",\"products\":[],\"status\":\"disconnected\",\"url\":\"<Trello
45
- URL>\",\"username\":\"gavinlaking1\",\"avatarSource\":\"gravatar\",\"email\":\"gavinlaking@gmail.com\",\"gravatarHash\":\"c9c47875936bed67032a12c047b468a8\",\"idBoards\":[\"526d8e130a14a9d846001d96\"],\"idBoardsInvited\":[],\"idBoardsPinned\":[\"526d8e130a14a9d846001d96\"],\"idOrganizations\":[],\"idOrganizationsInvited\":[],\"loginTypes\":null,\"newEmail\":null,\"oneTimeMessagesDismissed\":[\"newtrelloIntro\"],\"prefs\":{\"timezoneInfo\":{\"timezoneNext\":\"BST\",\"dateNext\":\"2014-03-30T01:00:00.000Z\",\"offsetNext\":-60,\"timezoneCurrent\":\"GMT\",\"offsetCurrent\":0},\"sendSummaries\":true,\"minutesBetweenSummaries\":60,\"minutesBeforeDeadlineToNotify\":1440,\"colorBlind\":false},\"trophies\":[\"Android\"],\"uploadedAvatarHash\":null,\"premiumFeatures\":[]}]"
46
- http_version:
47
- recorded_at: Fri, 21 Feb 2014 19:12:14 GMT
48
- recorded_with: VCR 2.8.0
@@ -1,113 +0,0 @@
1
- require_relative '../../../test_helper'
2
-
3
- module Troo
4
- module Decorators
5
- describe Card do
6
- # let(:described_class) { Card }
7
- # let(:described_instance) { described_class.new(@card, options) }
8
- # let(:default) { true }
9
- # let(:description) { 'Finish Troo for fame and fortune.' }
10
- # let(:options) { {} }
11
-
12
- # before do
13
- # @board = Fabricate(:board)
14
- # @list = Fabricate(:list)
15
- # @card = Fabricate(:card,
16
- # desc: description,
17
- # default: default)
18
- # @comment = Fabricate(:comment)
19
- # @comment_2 = Fabricate(:comment,
20
- # text: 'My Other Test Comment')
21
- # @comment_3 = Fabricate(:comment,
22
- # text: 'My Lithium Comment')
23
- # @comment_4 = Fabricate(:comment,
24
- # text: 'My Beryllium Comment')
25
- # @member = Fabricate(:member)
26
- # @member_2 = Fabricate(:member,
27
- # username: 'mysterywoman',
28
- # external_member_id: 'some_member_id')
29
- # end
30
-
31
- # after { database_cleanup }
32
-
33
- # describe '#comments' do
34
- # subject { described_instance.comments }
35
-
36
- # context 'when there are more than 3 comments' do
37
- # it 'returns the comments' do
38
- # subject.must_match(/There are more comments/)
39
- # subject.must_match(/My Test Comment/)
40
- # subject.must_match(/My Other Test Comment/)
41
- # subject.must_match(/My Lithium Comment/)
42
- # subject.wont_match(/My Beryllium Comment/)
43
- # end
44
- # end
45
-
46
- # context 'when there are 3 or less comments' do
47
- # before do
48
- # @comment_3.delete
49
- # @comment_4.delete
50
- # end
51
-
52
- # it 'returns the comments' do
53
- # subject.must_match(/My Test Comment/)
54
- # subject.must_match(/My Other Test Comment/)
55
- # end
56
- # end
57
-
58
- # context 'when there are no comments' do
59
- # before do
60
- # @comment.delete
61
- # @comment_2.delete
62
- # @comment_3.delete
63
- # @comment_4.delete
64
- # end
65
-
66
- # it 'returns a polite message' do
67
- # subject.must_equal('No comments have been left.')
68
- # end
69
- # end
70
- # end
71
-
72
- # describe '#members' do
73
- # subject { described_instance.members }
74
-
75
- # context 'when there are members' do
76
- # it 'returns the members' do
77
- # subject.must_equal('@gavinlaking1')
78
- # end
79
- # end
80
-
81
- # context 'when there are no members' do
82
- # before do
83
- # @card.external_member_ids = nil
84
- # @member.delete
85
- # @member_2.delete
86
- # end
87
-
88
- # it 'returns a polite message' do
89
- # subject.must_equal('No members have been assigned.')
90
- # end
91
- # end
92
- # end
93
-
94
- # describe '#last_activity_date' do
95
- # subject { described_instance.last_activity_date }
96
-
97
- # context 'when the last activity date is set' do
98
- # it 'returns the last activity date' do
99
- # subject.must_equal('Tue, Dec 17 at 21:48')
100
- # end
101
- # end
102
-
103
- # context 'when the last activity date is not set' do
104
- # before { @card.stubs(:last_activity_date) }
105
-
106
- # it "returns 'N/A'" do
107
- # subject.must_equal('N/A')
108
- # end
109
- # end
110
- # end
111
- end
112
- end
113
- end