troo 0.0.7 → 0.0.8

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 (271) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +2 -0
  4. data/Guardfile +3 -1
  5. data/Rakefile +7 -0
  6. data/bin/troo +3 -8
  7. data/config/.gitkeep +0 -0
  8. data/config/cucumber.yml +8 -0
  9. data/features/add/board.feature +26 -0
  10. data/features/add/card.feature +34 -0
  11. data/features/add/comment.feature +21 -0
  12. data/features/add/list.feature +24 -0
  13. data/features/cleanup.feature +13 -0
  14. data/features/default/board.feature +21 -0
  15. data/features/default/card.feature +21 -0
  16. data/features/default/list.feature +21 -0
  17. data/features/refresh/all.feature +7 -0
  18. data/features/refresh/board.feature +26 -0
  19. data/features/refresh/card.feature +27 -0
  20. data/features/refresh/list.feature +27 -0
  21. data/features/show/board.feature +32 -0
  22. data/features/show/card.feature +62 -0
  23. data/features/show/comment.feature +39 -0
  24. data/features/show/list.feature +37 -0
  25. data/features/status.feature +46 -1
  26. data/features/step_definitions/fabrication_steps.rb +34 -0
  27. data/features/step_definitions/troo_steps.rb +16 -0
  28. data/features/support/env.rb +22 -24
  29. data/features/troo.feature +31 -1
  30. data/lib/troo/actions/create_board.rb +10 -7
  31. data/lib/troo/actions/create_card.rb +5 -4
  32. data/lib/troo/actions/create_comment.rb +15 -13
  33. data/lib/troo/actions/create_list.rb +5 -4
  34. data/lib/troo/actions/move_card.rb +4 -3
  35. data/lib/troo/{external/board_adaptor.rb → adaptors/board.rb} +3 -14
  36. data/lib/troo/{external/card_adaptor.rb → adaptors/card.rb} +4 -15
  37. data/lib/troo/{external/comment_adaptor.rb → adaptors/comment.rb} +6 -17
  38. data/lib/troo/{external/list_adaptor.rb → adaptors/list.rb} +3 -14
  39. data/lib/troo/{external/member_adaptor.rb → adaptors/member.rb} +3 -14
  40. data/lib/troo/adaptors/resource.rb +17 -0
  41. data/lib/troo/cli/add.rb +53 -0
  42. data/lib/troo/cli/default.rb +25 -0
  43. data/lib/troo/cli/main.rb +46 -0
  44. data/lib/troo/cli/refresh.rb +31 -0
  45. data/lib/troo/cli/show.rb +41 -0
  46. data/lib/troo/cli/thor_fixes.rb +13 -0
  47. data/lib/troo/commands/add/board.rb +26 -0
  48. data/lib/troo/commands/add/card.rb +33 -0
  49. data/lib/troo/commands/add/comment.rb +33 -0
  50. data/lib/troo/commands/add/list.rb +33 -0
  51. data/lib/troo/commands/add/resource.rb +21 -0
  52. data/lib/troo/commands/commands.rb +28 -0
  53. data/lib/troo/commands/default/board.rb +25 -0
  54. data/lib/troo/commands/default/card.rb +25 -0
  55. data/lib/troo/commands/default/list.rb +25 -0
  56. data/lib/troo/commands/default/resource.rb +26 -0
  57. data/lib/troo/commands/refresh/all.rb +41 -0
  58. data/lib/troo/commands/refresh/board.rb +28 -0
  59. data/lib/troo/commands/refresh/card.rb +29 -0
  60. data/lib/troo/commands/refresh/list.rb +29 -0
  61. data/lib/troo/commands/refresh/resource.rb +42 -0
  62. data/lib/troo/commands/show/board.rb +13 -0
  63. data/lib/troo/commands/show/boards.rb +35 -0
  64. data/lib/troo/commands/show/card.rb +13 -0
  65. data/lib/troo/commands/show/comments.rb +21 -0
  66. data/lib/troo/commands/show/list.rb +13 -0
  67. data/lib/troo/commands/show/resource.rb +41 -0
  68. data/lib/troo/commands/status/board.rb +30 -0
  69. data/lib/troo/commands/status/card.rb +30 -0
  70. data/lib/troo/commands/status/list.rb +30 -0
  71. data/lib/troo/commands/status/resource.rb +34 -0
  72. data/lib/troo/decorators/board.rb +66 -0
  73. data/lib/troo/decorators/card.rb +105 -0
  74. data/lib/troo/decorators/comment.rb +36 -0
  75. data/lib/troo/decorators/list.rb +60 -0
  76. data/lib/troo/decorators/member.rb +28 -0
  77. data/lib/troo/external/board.rb +14 -26
  78. data/lib/troo/external/card.rb +2 -19
  79. data/lib/troo/external/comment.rb +5 -23
  80. data/lib/troo/external/list.rb +2 -20
  81. data/lib/troo/external/member.rb +2 -20
  82. data/lib/troo/external/resource.rb +21 -6
  83. data/lib/troo/helpers/command_helpers.rb +37 -0
  84. data/lib/troo/{display → helpers}/decorator_helpers.rb +23 -17
  85. data/lib/troo/{models → helpers}/model_helpers.rb +1 -1
  86. data/lib/troo/models/behaviours/set_default.rb +49 -0
  87. data/lib/troo/models/board.rb +10 -7
  88. data/lib/troo/models/card.rb +33 -15
  89. data/lib/troo/models/comment.rb +8 -5
  90. data/lib/troo/models/list.rb +10 -6
  91. data/lib/troo/models/member.rb +7 -4
  92. data/lib/troo/models/persistence/board.rb +19 -0
  93. data/lib/troo/models/persistence/card.rb +19 -0
  94. data/lib/troo/models/persistence/comment.rb +19 -0
  95. data/lib/troo/models/persistence/list.rb +19 -0
  96. data/lib/troo/models/persistence/member.rb +19 -0
  97. data/lib/troo/models/persistence/resource.rb +50 -0
  98. data/lib/troo/models/refresh.rb +1 -1
  99. data/lib/troo/models/remote/comment.rb +21 -0
  100. data/lib/troo/models/remote/resource.rb +25 -0
  101. data/lib/troo/models/retrieval/board.rb +29 -0
  102. data/lib/troo/models/retrieval/card.rb +33 -0
  103. data/lib/troo/models/retrieval/comment.rb +25 -0
  104. data/lib/troo/models/retrieval/list.rb +29 -0
  105. data/lib/troo/models/retrieval/member.rb +25 -0
  106. data/lib/troo/models/retrieval/resource.rb +36 -0
  107. data/lib/troo/presentation/sentence.rb +57 -0
  108. data/lib/troo/presentation/template.rb +4 -3
  109. data/lib/troo/presenters/board.rb +81 -0
  110. data/lib/troo/presenters/card.rb +30 -0
  111. data/lib/troo/presenters/comment.rb +38 -0
  112. data/lib/troo/presenters/list.rb +44 -0
  113. data/lib/troo/presenters/member.rb +32 -0
  114. data/lib/troo/troo.rb +79 -65
  115. data/lib/troo/version.rb +1 -2
  116. data/lib/troo.rb +36 -8
  117. data/test/lib/troo/actions/create_board_test.rb +34 -15
  118. data/test/lib/troo/actions/create_card_test.rb +35 -18
  119. data/test/lib/troo/actions/create_comment_test.rb +38 -16
  120. data/test/lib/troo/actions/create_list_test.rb +31 -15
  121. data/test/lib/troo/actions/move_card_test.rb +23 -15
  122. data/test/lib/troo/adaptors/board_test.rb +38 -0
  123. data/test/lib/troo/adaptors/card_test.rb +49 -0
  124. data/test/lib/troo/adaptors/comment_test.rb +41 -0
  125. data/test/lib/troo/adaptors/list_test.rb +38 -0
  126. data/test/lib/troo/adaptors/member_test.rb +44 -0
  127. data/test/lib/troo/commands/add/board_test.rb +43 -0
  128. data/test/lib/troo/commands/add/card_test.rb +44 -0
  129. data/test/lib/troo/commands/add/comment_test.rb +44 -0
  130. data/test/lib/troo/commands/add/list_test.rb +44 -0
  131. data/test/lib/troo/commands/add/resource_test.rb +25 -0
  132. data/test/lib/troo/commands/default/board_test.rb +37 -0
  133. data/test/lib/troo/commands/default/card_test.rb +37 -0
  134. data/test/lib/troo/commands/default/list_test.rb +37 -0
  135. data/test/lib/troo/commands/default/resource_test.rb +20 -0
  136. data/test/lib/troo/commands/refresh/all_test.rb +39 -0
  137. data/test/lib/troo/commands/refresh/board_test.rb +62 -0
  138. data/test/lib/troo/commands/refresh/card_test.rb +62 -0
  139. data/test/lib/troo/commands/refresh/list_test.rb +62 -0
  140. data/test/lib/troo/commands/refresh/resource_test.rb +20 -0
  141. data/test/lib/troo/commands/show/board_test.rb +65 -0
  142. data/test/lib/troo/commands/show/boards_test.rb +36 -0
  143. data/test/lib/troo/commands/show/card_test.rb +64 -0
  144. data/test/lib/troo/commands/show/comments_test.rb +64 -0
  145. data/test/lib/troo/commands/show/list_test.rb +64 -0
  146. data/test/lib/troo/commands/show/resource_test.rb +25 -0
  147. data/test/lib/troo/commands/status/board_test.rb +43 -0
  148. data/test/lib/troo/commands/status/card_test.rb +43 -0
  149. data/test/lib/troo/commands/status/list_test.rb +43 -0
  150. data/test/lib/troo/commands/status/resource_test.rb +19 -0
  151. data/test/lib/troo/decorators/board_test.rb +129 -0
  152. data/test/lib/troo/decorators/card_test.rb +237 -0
  153. data/test/lib/troo/decorators/comment_test.rb +74 -0
  154. data/test/lib/troo/decorators/list_test.rb +102 -0
  155. data/test/lib/troo/decorators/member_test.rb +50 -0
  156. data/test/lib/troo/external/board_test.rb +74 -41
  157. data/test/lib/troo/external/card_test.rb +49 -37
  158. data/test/lib/troo/external/comment_test.rb +43 -33
  159. data/test/lib/troo/external/list_test.rb +37 -30
  160. data/test/lib/troo/external/member_test.rb +37 -30
  161. data/test/lib/troo/external/resource_test.rb +18 -1
  162. data/test/lib/troo/helpers/command_helpers_test.rb +82 -0
  163. data/test/lib/troo/{display → helpers}/decorator_helpers_test.rb +6 -6
  164. data/test/lib/troo/helpers/model_helpers_test.rb +103 -0
  165. data/test/lib/troo/models/behaviours/set_default_test.rb +54 -0
  166. data/test/lib/troo/models/board_test.rb +13 -14
  167. data/test/lib/troo/models/card_test.rb +64 -33
  168. data/test/lib/troo/models/comment_test.rb +18 -19
  169. data/test/lib/troo/models/list_test.rb +15 -15
  170. data/test/lib/troo/models/member_test.rb +18 -18
  171. data/test/lib/troo/models/persistence/board_test.rb +62 -0
  172. data/test/lib/troo/models/persistence/card_test.rb +61 -0
  173. data/test/lib/troo/models/persistence/comment_test.rb +69 -0
  174. data/test/lib/troo/models/persistence/list_test.rb +60 -0
  175. data/test/lib/troo/models/persistence/member_test.rb +60 -0
  176. data/test/lib/troo/models/refresh_test.rb +12 -11
  177. data/test/lib/troo/models/remote/comment_test.rb +56 -0
  178. data/test/lib/troo/models/remote/resource_test.rb +26 -0
  179. data/test/lib/troo/models/retrieval/board_test.rb +93 -0
  180. data/test/lib/troo/models/retrieval/card_test.rb +101 -0
  181. data/test/lib/troo/models/retrieval/comment_test.rb +46 -0
  182. data/test/lib/troo/models/retrieval/list_test.rb +93 -0
  183. data/test/lib/troo/models/retrieval/member_test.rb +58 -0
  184. data/test/lib/troo/presentation/sentence_test.rb +57 -0
  185. data/test/lib/troo/presentation/template_test.rb +17 -16
  186. data/test/lib/troo/presenters/board_test.rb +79 -0
  187. data/test/lib/troo/presenters/card_test.rb +41 -0
  188. data/test/lib/troo/presenters/comment_test.rb +49 -0
  189. data/test/lib/troo/presenters/list_test.rb +50 -0
  190. data/test/lib/troo/presenters/member_test.rb +40 -0
  191. data/test/support/fabrication.rb +31 -32
  192. data/test/support/vcr_setup.rb +7 -9
  193. data/test/system_test.sh +55 -0
  194. data/test/test_helper.rb +10 -10
  195. data/troo.gemspec +1 -0
  196. metadata +232 -134
  197. data/features/add_board.feature +0 -1
  198. data/features/add_card.feature +0 -1
  199. data/features/add_comment.feature +0 -1
  200. data/features/add_list.feature +0 -1
  201. data/features/move_card_to_list.feature +0 -1
  202. data/features/refresh.feature +0 -1
  203. data/features/set_default.feature +0 -7
  204. data/features/show_board.feature +0 -1
  205. data/features/show_boards.feature +0 -1
  206. data/features/show_card.feature +0 -1
  207. data/features/show_comments.feature +0 -1
  208. data/features/show_list.feature +0 -1
  209. data/features/version.feature +0 -8
  210. data/lib/troo/actions/refresh_all.rb +0 -79
  211. data/lib/troo/actions/set_default.rb +0 -46
  212. data/lib/troo/cli/add_cli.rb +0 -83
  213. data/lib/troo/cli/cli_helpers.rb +0 -34
  214. data/lib/troo/cli/default_cli.rb +0 -32
  215. data/lib/troo/cli/main_cli.rb +0 -132
  216. data/lib/troo/cli/show_cli.rb +0 -64
  217. data/lib/troo/display/board_decorator.rb +0 -62
  218. data/lib/troo/display/board_presenter.rb +0 -71
  219. data/lib/troo/display/card_decorator.rb +0 -100
  220. data/lib/troo/display/card_presenter.rb +0 -27
  221. data/lib/troo/display/comment_decorator.rb +0 -33
  222. data/lib/troo/display/comment_presenter.rb +0 -31
  223. data/lib/troo/display/list_decorator.rb +0 -57
  224. data/lib/troo/display/list_presenter.rb +0 -41
  225. data/lib/troo/display/member_decorator.rb +0 -25
  226. data/lib/troo/display/member_presenter.rb +0 -59
  227. data/lib/troo/models/board_persistence.rb +0 -25
  228. data/lib/troo/models/board_retrieval.rb +0 -45
  229. data/lib/troo/models/card_persistence.rb +0 -25
  230. data/lib/troo/models/card_retrieval.rb +0 -49
  231. data/lib/troo/models/comment_persistence.rb +0 -25
  232. data/lib/troo/models/comment_retrieval.rb +0 -32
  233. data/lib/troo/models/list_persistence.rb +0 -25
  234. data/lib/troo/models/list_retrieval.rb +0 -45
  235. data/lib/troo/models/member_persistence.rb +0 -25
  236. data/lib/troo/models/member_retrieval.rb +0 -36
  237. data/lib/troo/models/persistence.rb +0 -39
  238. data/test/lib/troo/actions/refresh_all_test.rb +0 -68
  239. data/test/lib/troo/actions/set_default_test.rb +0 -44
  240. data/test/lib/troo/cli/add_cli_test.rb +0 -216
  241. data/test/lib/troo/cli/cli_helpers_test.rb +0 -24
  242. data/test/lib/troo/cli/default_cli_test.rb +0 -85
  243. data/test/lib/troo/cli/main_cli_test.rb +0 -234
  244. data/test/lib/troo/cli/show_cli_test.rb +0 -251
  245. data/test/lib/troo/display/board_decorator_test.rb +0 -126
  246. data/test/lib/troo/display/board_presenter_test.rb +0 -77
  247. data/test/lib/troo/display/card_decorator_test.rb +0 -213
  248. data/test/lib/troo/display/card_presenter_test.rb +0 -38
  249. data/test/lib/troo/display/comment_decorator_test.rb +0 -70
  250. data/test/lib/troo/display/comment_presenter_test.rb +0 -47
  251. data/test/lib/troo/display/list_decorator_test.rb +0 -98
  252. data/test/lib/troo/display/list_presenter_test.rb +0 -48
  253. data/test/lib/troo/display/member_decorator_test.rb +0 -47
  254. data/test/lib/troo/display/member_presenter_test.rb +0 -70
  255. data/test/lib/troo/external/board_adaptor_test.rb +0 -36
  256. data/test/lib/troo/external/card_adaptor_test.rb +0 -50
  257. data/test/lib/troo/external/comment_adaptor_test.rb +0 -41
  258. data/test/lib/troo/external/list_adaptor_test.rb +0 -38
  259. data/test/lib/troo/external/member_adaptor_test.rb +0 -44
  260. data/test/lib/troo/models/board_persistence_test.rb +0 -61
  261. data/test/lib/troo/models/board_retrieval_test.rb +0 -93
  262. data/test/lib/troo/models/card_persistence_test.rb +0 -60
  263. data/test/lib/troo/models/card_retrieval_test.rb +0 -101
  264. data/test/lib/troo/models/comment_persistence_test.rb +0 -65
  265. data/test/lib/troo/models/comment_retrieval_test.rb +0 -46
  266. data/test/lib/troo/models/list_persistence_test.rb +0 -60
  267. data/test/lib/troo/models/list_retrieval_test.rb +0 -93
  268. data/test/lib/troo/models/member_persistence_test.rb +0 -59
  269. data/test/lib/troo/models/member_retrieval_test.rb +0 -58
  270. data/test/lib/troo/models/model_helpers_test.rb +0 -103
  271. data/test/lib/troo/models/persistence_test.rb +0 -6
@@ -1,251 +0,0 @@
1
- require_relative "../../../test_helper"
2
- require "thor"
3
-
4
- module Troo
5
- module CLI
6
- describe Show do
7
- let(:described_class) { Show }
8
- let(:board_id) { "526d8e130a14a9d846001d96" }
9
- let(:list_id) { "526d8e130a14a9d846001d97" }
10
- let(:card_id) { "526d8f19ddb279532e005259" }
11
-
12
- before do
13
- @board = Fabricate(:board)
14
- @board_2 = Fabricate(:board, name: "My Other Board")
15
- @list = Fabricate(:list)
16
- @card = Fabricate(:card)
17
- @comment = Fabricate(:comment)
18
- @member = Fabricate(:member)
19
- end
20
-
21
- after { database_cleanup }
22
-
23
- describe "#boards" do
24
- subject { capture_io { described_class.new.boards }.join }
25
-
26
- context "when boards exist" do
27
- it "returns a list of boards" do
28
- subject.must_match /Test Board/
29
- subject.must_match /Other Board/
30
- end
31
- end
32
-
33
- context "when no boards exist" do
34
- before { BoardRetrieval.stubs(:all).returns([]) }
35
-
36
- it "returns a polite message" do
37
- subject.must_match /Boards not found./
38
- end
39
- end
40
- end
41
-
42
- describe "#board" do
43
- subject { capture_io { described_class.new.board(board_id) }.join }
44
-
45
- context "when a board_id was provided" do
46
- context "and the board exists" do
47
- it "returns the board with all lists and all cards" do
48
- subject.must_match /Test Board/
49
- subject.must_match /Test List/
50
- subject.must_match /Test Card/
51
- end
52
-
53
- context "but there are no lists" do
54
- before { @list.delete }
55
-
56
- it "returns a polite message" do
57
- subject.must_match /No lists were found/
58
- end
59
- end
60
- end
61
-
62
- context "and the board does not exist" do
63
- before { BoardRetrieval.stubs(:retrieve) }
64
-
65
- it "returns a polite message" do
66
- subject.must_match /Board cannot be found./
67
- end
68
- end
69
- end
70
-
71
- context "when a board_id was not provided" do
72
- let(:board_id) { }
73
-
74
- context "and the default board is set" do
75
- before { BoardRetrieval.stubs(:retrieve).returns(@board) }
76
-
77
- it "returns the board with all lists and all cards" do
78
- subject.must_match /Test Board/
79
- subject.must_match /Test List/
80
- subject.must_match /Test Card/
81
- end
82
- end
83
-
84
- context "and the default board is not set" do
85
- before { BoardRetrieval.stubs(:retrieve) }
86
-
87
- it "returns a polite message" do
88
- subject.must_match /set a default board first/
89
- end
90
- end
91
- end
92
- end
93
-
94
- describe "#list" do
95
- subject { capture_io { described_class.new.list(list_id) }.join }
96
-
97
- context "when a list_id was provided" do
98
- context "and the list exists" do
99
- it "returns the list's board, the list and all cards" do
100
- subject.must_match /Test Board/
101
- subject.must_match /Test List/
102
- subject.must_match /Test Card/
103
- end
104
-
105
- context "but there are no cards" do
106
- before { @card.delete }
107
-
108
- it "returns a polite message" do
109
- subject.must_match /No cards were found/
110
- end
111
- end
112
- end
113
-
114
- context "and the list does not exist" do
115
- before { ListRetrieval.stubs(:retrieve) }
116
-
117
- it "returns a polite message" do
118
- subject.must_match /List cannot be found/
119
- end
120
- end
121
- end
122
-
123
- context "when a list_id was not provided" do
124
- let(:list_id) { }
125
-
126
- context "and the default list is set" do
127
- before { ListRetrieval.stubs(:retrieve).returns(@list) }
128
-
129
- it "returns the list's board, the list and all cards" do
130
- subject.must_match /Test Board/
131
- subject.must_match /Test List/
132
- subject.must_match /Test Card/
133
- end
134
- end
135
-
136
- context "and the default list is not set" do
137
- before { ListRetrieval.stubs(:retrieve) }
138
-
139
- it "returns a polite message" do
140
- subject.must_match /set a default list first/
141
- end
142
- end
143
- end
144
- end
145
-
146
- describe "#card" do
147
- subject { capture_io { described_class.new.card(card_id) }.join }
148
-
149
- context "when a card_id was provided" do
150
- context "and the card exists" do
151
- it "returns the card details" do
152
- subject.must_match /\(67\) My Test Card/
153
- subject.must_match /some description/
154
- subject.must_match /Metadata/
155
- subject.must_match /Tue, Dec 17 at 21:48/
156
- end
157
-
158
- context "but there are no comments" do
159
- before { @comment.delete }
160
-
161
- it "returns a polite message" do
162
- subject.must_match /No comments have been left/
163
- end
164
- end
165
- end
166
-
167
- context "and the card does not exist" do
168
- before { CardRetrieval.stubs(:retrieve) }
169
-
170
- it "returns a polite message" do
171
- subject.must_match /Card cannot be found/
172
- end
173
- end
174
- end
175
-
176
- context "when a card_id was not provided" do
177
- let(:card_id) { }
178
-
179
- context "and the default card is set" do
180
- before { CardRetrieval.stubs(:retrieve).returns(@card) }
181
-
182
- it "returns the card details" do
183
- subject.must_match /\(67\) My Test Card/
184
- subject.must_match /some description/
185
- subject.must_match /Metadata/
186
- subject.must_match /Tue, Dec 17 at 21:48/
187
- end
188
- end
189
-
190
- context "and the default card is not set" do
191
- before { CardRetrieval.stubs(:retrieve) }
192
-
193
- it "returns a polite message" do
194
- subject.must_match /set a default card first/
195
- end
196
- end
197
- end
198
- end
199
-
200
- describe "#comments" do
201
- subject { capture_io { described_class.new.comments(card_id) }.join }
202
-
203
- context "when a card_id was provided" do
204
- context "and the card exists" do
205
- it "returns the card and all comments" do
206
- subject.must_match /My Test Card/
207
- subject.must_match /My Test Comment/
208
- end
209
-
210
- context "but there are no comments" do
211
- before { @comment.delete }
212
-
213
- it "returns a polite message" do
214
- subject.must_match /No comments were found/
215
- end
216
- end
217
- end
218
-
219
- context "and the card does not exist" do
220
- before { CardRetrieval.stubs(:retrieve) }
221
-
222
- it "returns a polite message" do
223
- subject.must_match /Card cannot be found/
224
- end
225
- end
226
- end
227
-
228
- context "when a card_id was not provided" do
229
- let(:card_id) { }
230
-
231
- context "and the default card is set" do
232
- before { CardRetrieval.stubs(:retrieve).returns(@card) }
233
-
234
- it "returns the card and all comments" do
235
- subject.must_match /My Test Card/
236
- subject.must_match /My Test Comment/
237
- end
238
- end
239
-
240
- context "and the default card is not set" do
241
- before { CardRetrieval.stubs(:retrieve) }
242
-
243
- it "returns a polite message" do
244
- subject.must_match /set a default card first/
245
- end
246
- end
247
- end
248
- end
249
- end
250
- end
251
- end
@@ -1,126 +0,0 @@
1
- require_relative "../../../test_helper"
2
-
3
- module Troo
4
- describe BoardDecorator do
5
- let(:described_class) { BoardDecorator }
6
- let(:default) { true }
7
- let(:options) { {} }
8
-
9
- before { @board = Fabricate(:board, default: default) }
10
- after { database_cleanup }
11
-
12
- describe "#initialize" do
13
- subject { described_class.new(@board, options) }
14
-
15
- it "assigns the board to an instance variable" do
16
- subject.instance_variable_get("@board").must_equal(@board)
17
- end
18
-
19
- it "assigns the options to an instance variable" do
20
- subject.instance_variable_get("@options").must_equal(options)
21
- end
22
- end
23
-
24
- describe "#short" do
25
- subject { described_class.new(@board, options).short }
26
-
27
- it "returns a one line overview of the board" do
28
- subject.must_equal(" * \e[34m\e[4m(1) \e[0m\e[34m\e[4mMy Test Board\e[0m\n")
29
- end
30
-
31
- context "when the ansicolor option is false" do
32
- let(:options) { { ansicolor: false } }
33
-
34
- it "returns a one line overview of the board" do
35
- subject.must_equal(" * (1) My Test Board\n")
36
- end
37
- end
38
- end
39
-
40
- describe "#name_str" do
41
- subject { described_class.new(@board).name_str }
42
-
43
- it "returns the formatted board name" do
44
- subject.must_equal("\e[34m\e[4mMy Test Board\e[0m")
45
- end
46
- end
47
-
48
- describe "#default_str" do
49
- subject { described_class.new(@board).default_str }
50
-
51
- it "returns the formatted board default indicator" do
52
- subject.must_equal(" * ")
53
- end
54
- end
55
-
56
- describe "#id_str" do
57
- subject { described_class.new(@board).id_str }
58
-
59
- it "returns the formatted board id" do
60
- subject.must_equal("\e[34m\e[4m(1) \e[0m")
61
- end
62
- end
63
-
64
- describe "#description" do
65
- subject { described_class.new(@board).description }
66
-
67
- context "when the board has a description" do
68
- it "returns the board description" do
69
- subject.must_equal(@board.description)
70
- end
71
- end
72
-
73
- context "when the board has no description" do
74
- before { @board.stubs(:description) }
75
-
76
- it "returns N/A" do
77
- subject.must_equal("N/A")
78
- end
79
- end
80
- end
81
-
82
- describe "#name" do
83
- subject { described_class.new(@board).name }
84
-
85
- context "when the board has a name" do
86
- it "returns the board name" do
87
- subject.must_equal(@board.name)
88
- end
89
- end
90
-
91
- context "when the board has no name" do
92
- before { @board.stubs(:name) }
93
-
94
- it "returns N/A" do
95
- subject.must_equal("N/A")
96
- end
97
- end
98
- end
99
-
100
- describe "#default" do
101
- subject { described_class.new(@board).default }
102
-
103
- context "when default" do
104
- it "return an indicator" do
105
- subject.must_equal("*")
106
- end
107
- end
108
-
109
- context "when not default" do
110
- let(:default) { false }
111
-
112
- it "returns nothing" do
113
- subject.must_equal("")
114
- end
115
- end
116
- end
117
-
118
- describe "#id" do
119
- subject { described_class.new(@board).id }
120
-
121
- it "returns the board id" do
122
- subject.must_equal(@board.id.to_s)
123
- end
124
- end
125
- end
126
- end
@@ -1,77 +0,0 @@
1
- require_relative "../../../test_helper"
2
-
3
- module Troo
4
- describe BoardPresenter do
5
- let(:described_class) { BoardPresenter }
6
- let(:options) { { } }
7
-
8
- before do
9
- @board = Fabricate(:board)
10
- @list = Fabricate(:list)
11
- @card = Fabricate(:card)
12
- end
13
-
14
- after { database_cleanup }
15
-
16
- describe "#initialize" do
17
- subject { described_class.new(@board, options) }
18
-
19
- it "assigns the board to an instance variable" do
20
- subject.instance_variable_get("@board").must_equal(@board)
21
- end
22
-
23
- it "assigns the options to an instance variable" do
24
- subject.instance_variable_get("@options").must_equal(options)
25
- end
26
- end
27
-
28
- describe "#render_all" do
29
- subject { capture_io { described_class.new(@board, options).render_all }.join }
30
-
31
- context "when the board has lists" do
32
- it "renders the view" do
33
- subject.must_match /My Test Board/
34
- subject.must_match /My Test List/
35
- end
36
- end
37
-
38
- context "when the board has no lists" do
39
- before { @list.delete }
40
-
41
- it "returns a polite message" do
42
- subject.must_match /No lists were found./
43
- end
44
- end
45
- end
46
-
47
- describe "#show" do
48
- subject { capture_io { described_class.show(@board, options) }.join }
49
-
50
- context "when the board has lists" do
51
- context "and the list has cards" do
52
- it "renders the view" do
53
- subject.must_match /My Test Board/
54
- subject.must_match /My Test List/
55
- subject.must_match /My Test Card/
56
- end
57
- end
58
-
59
- context "and the list has no cards" do
60
- before { @card.delete }
61
-
62
- it "returns a polite message" do
63
- subject.must_match /No cards were found./
64
- end
65
- end
66
- end
67
-
68
- context "when the board has no lists" do
69
- before { @board.stubs(:lists).returns([]) }
70
-
71
- it "returns a polite message" do
72
- subject.must_match /No lists were found./
73
- end
74
- end
75
- end
76
- end
77
- end
@@ -1,213 +0,0 @@
1
- require_relative "../../../test_helper"
2
-
3
- module Troo
4
- describe CardDecorator do
5
- let(:described_class) { CardDecorator }
6
- let(:described_instance) { described_class.new(@card, options) }
7
- let(:default) { true }
8
- let(:description) { "Finish Troo for fame and fortune." }
9
- let(:options) { {} }
10
-
11
- before do
12
- @board = Fabricate(:board)
13
- @list = Fabricate(:list)
14
- @card = Fabricate(:card, desc: description, default: default, external_member_ids: ["5195fdb5a8c01a2318004f5d", "some_member_id"])
15
- @comment = Fabricate(:comment)
16
- @comment_2 = Fabricate(:comment, text: "My Other Test Comment")
17
- @comment_3 = Fabricate(:comment, text: "My Lithium Comment")
18
- @comment_4 = Fabricate(:comment, text: "My Beryllium Comment")
19
- @member = Fabricate(:member)
20
- @member_2 = Fabricate(:member, username: "mysterywoman", external_member_id: "some_member_id")
21
- end
22
-
23
- after { database_cleanup }
24
-
25
- describe "#initialize" do
26
- subject { described_instance }
27
-
28
- it "assigns the card to an instance variable" do
29
- subject.instance_variable_get("@card").must_equal(@card)
30
- end
31
-
32
- it "assigns the options to an instance variable" do
33
- subject.instance_variable_get("@options").must_equal(options)
34
- end
35
- end
36
-
37
- describe "#short" do
38
- subject { described_instance.short }
39
-
40
- it "returns a one line overview of the card" do
41
- subject.must_equal(" * \e[35m\e[4m(67) \e[0m\e[35m\e[4mMy Test Card\e[0m\n")
42
- end
43
-
44
- context "when the ansicolor option is false" do
45
- let(:options) { { ansicolor: false } }
46
-
47
- it "returns a one line overview of the card" do
48
- subject.must_equal(" * (67) My Test Card\n")
49
- end
50
- end
51
- end
52
-
53
- describe "#name_str" do
54
- subject { described_instance.name_str }
55
-
56
- it "returns the formatted card name" do
57
- subject.must_equal("\e[35m\e[4mMy Test Card\e[0m")
58
- end
59
- end
60
-
61
- describe "#default_str" do
62
- subject { described_instance.default_str }
63
-
64
- it "returns the formatted card default indicator" do
65
- subject.must_equal(" * ")
66
- end
67
- end
68
-
69
- describe "#id_str" do
70
- subject { described_instance.id_str }
71
-
72
- it "returns the formatted card id" do
73
- subject.must_equal("\e[35m\e[4m(67) \e[0m")
74
- end
75
- end
76
-
77
- describe "#name" do
78
- subject { described_instance.name }
79
-
80
- it "returns the card name" do
81
- subject.must_equal(@card.name)
82
- end
83
- end
84
-
85
- describe "#default" do
86
- subject { described_instance.default }
87
-
88
- context "when default" do
89
- it "return an indicator" do
90
- subject.must_equal("*")
91
- end
92
- end
93
-
94
- context "when not default" do
95
- let(:default) { false }
96
-
97
- it "returns nothing" do
98
- subject.must_equal("")
99
- end
100
- end
101
- end
102
-
103
- describe "#id" do
104
- subject { described_instance.id }
105
-
106
- it "returns the card id" do
107
- subject.must_equal(@card.short_id)
108
- end
109
- end
110
-
111
- describe "#description" do
112
- subject { described_instance.description }
113
-
114
- context "when there are further details" do
115
- it "returns the description" do
116
- subject.must_equal(@card.desc)
117
- end
118
- end
119
-
120
- context "when there are no further details" do
121
- let(:description) { nil }
122
-
123
- it "returns a polite message" do
124
- subject.must_equal("There are no further details at this time.")
125
- end
126
- end
127
- end
128
-
129
- describe "#comments" do
130
- subject { described_instance.comments }
131
-
132
- context "when there are more than 3 comments" do
133
- it "returns the comments" do
134
- subject.must_match /There are more comments/
135
- subject.must_match /My Test Comment/
136
- subject.must_match /My Other Test Comment/
137
- subject.must_match /My Lithium Comment/
138
- subject.wont_match /My Beryllium Comment/
139
- end
140
- end
141
-
142
- context "when there are 3 or less comments" do
143
- before do
144
- @comment_3.delete
145
- @comment_4.delete
146
- end
147
-
148
- it "returns the comments" do
149
- subject.must_match /My Test Comment/
150
- subject.must_match /My Other Test Comment/
151
- end
152
- end
153
-
154
- context "when there are no comments" do
155
- before do
156
- @comment.delete
157
- @comment_2.delete
158
- @comment_3.delete
159
- @comment_4.delete
160
- end
161
-
162
- it "returns a polite message" do
163
- subject.must_equal("No comments have been left.")
164
- end
165
- end
166
- end
167
-
168
- describe "#members" do
169
- subject { described_instance.members }
170
-
171
- context "when there are members" do
172
- it "returns the members" do
173
- subject.must_equal("@gavinlaking1 and @mysterywoman")
174
- end
175
- end
176
-
177
- context "when there are no members" do
178
- before do
179
- @member.delete
180
- @member_2.delete
181
- end
182
-
183
- it "returns a polite message" do
184
- subject.must_equal("No members have been assigned.")
185
- end
186
- end
187
- end
188
-
189
- describe "#last_activity_date" do
190
- subject { described_instance.last_activity_date }
191
-
192
- it "returns the last activity date" do
193
- subject.must_equal("Tue, Dec 17 at 21:48")
194
- end
195
- end
196
-
197
- describe "#board" do
198
- subject { described_instance.board }
199
-
200
- it "returns the board details" do
201
- subject.must_equal " \e[35m\e[4m(1) \e[0m\e[35m\e[4mMy Test Board\e[0m\n"
202
- end
203
- end
204
-
205
- describe "#list" do
206
- subject { described_class.new(@card).list }
207
-
208
- it "returns the list details" do
209
- subject.must_equal " \e[35m\e[4m(1) \e[0m\e[35m\e[4mMy Test List\e[0m\n"
210
- end
211
- end
212
- end
213
- end
@@ -1,38 +0,0 @@
1
- require_relative "../../../test_helper"
2
-
3
- module Troo
4
- describe CardPresenter do
5
- let(:described_class) { CardPresenter }
6
- let(:options) { { } }
7
-
8
- before do
9
- @card = Fabricate(:card)
10
- @board = Fabricate(:board)
11
- @list = Fabricate(:list)
12
- end
13
-
14
- after { database_cleanup }
15
-
16
- describe "#initialize" do
17
- subject { described_class.new(@card, options) }
18
-
19
- it "assigns the card to an instance variable" do
20
- subject.instance_variable_get("@card").must_equal(@card)
21
- end
22
-
23
- it "assigns the options to an instance variable" do
24
- subject.instance_variable_get("@options").must_equal(options)
25
- end
26
- end
27
-
28
- describe "#show" do
29
- subject { capture_io { described_class.show(@card, options) }.join }
30
-
31
- it "renders the view" do
32
- subject.must_match /My Test Card/
33
- subject.must_match /No comments have been left/
34
- subject.must_match /Metadata/
35
- end
36
- end
37
- end
38
- end