paradeiser 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Guardfile +16 -11
  4. data/README.md +1 -1
  5. data/Rakefile +1 -1
  6. data/TODO.md +12 -1
  7. data/bin/par +5 -2
  8. data/lib/paradeiser.rb +22 -2
  9. data/lib/paradeiser/controllers/controller.rb +1 -0
  10. data/lib/paradeiser/controllers/paradeiser_controller.rb +0 -1
  11. data/lib/paradeiser/models/hook.rb +4 -0
  12. data/lib/paradeiser/models/repository.rb +1 -1
  13. data/lib/paradeiser/models/scheduled.rb +4 -0
  14. data/lib/paradeiser/version.rb +1 -1
  15. data/paradeiser.gemspec +1 -6
  16. data/templates/linux/hooks/after-finish-break +2 -0
  17. data/templates/linux/hooks/after-finish-pomodoro +2 -0
  18. data/templates/linux/hooks/after-start-break +2 -0
  19. data/templates/linux/hooks/after-start-pomodoro +2 -0
  20. data/templates/mac/hooks/after-finish-break +2 -0
  21. data/templates/mac/hooks/after-finish-pomodoro +2 -0
  22. data/templates/mac/hooks/after-start-break +2 -0
  23. data/templates/mac/hooks/after-start-pomodoro +2 -0
  24. data/test/helper.rb +14 -36
  25. data/test/integration/test_annotate.rb +15 -13
  26. data/test/integration/test_finish.rb +7 -5
  27. data/test/integration/test_interrupt.rb +7 -5
  28. data/test/integration/test_log.rb +9 -7
  29. data/test/integration/test_no_args.rb +5 -3
  30. data/test/integration/test_start.rb +5 -3
  31. data/test/integration/test_status.rb +8 -6
  32. data/test/integration/test_unknown.rb +5 -3
  33. data/test/lib/controller_test.rb +4 -2
  34. data/test/lib/integration_test.rb +8 -2
  35. data/test/lib/paradeiser_controller_test.rb +7 -1
  36. data/test/lib/token_file_registry.rb +19 -0
  37. data/test/lib/unit_test.rb +47 -0
  38. data/test/lib/view_test.rb +13 -8
  39. data/test/scripts/create-failing-hooks +17 -0
  40. data/test/scripts/fail +5 -0
  41. data/test/unit/test_break.rb +43 -40
  42. data/test/unit/test_break_view.rb +17 -14
  43. data/test/unit/test_breaks_controller.rb +55 -52
  44. data/test/unit/test_interrupt.rb +27 -24
  45. data/test/unit/test_paradeiser_controller_export.rb +103 -100
  46. data/test/unit/test_paradeiser_controller_init.rb +2 -2
  47. data/test/unit/test_paradeiser_controller_report.rb +72 -69
  48. data/test/unit/test_paradeiser_controller_status.rb +78 -75
  49. data/test/unit/test_paradeiser_view_init.rb +5 -3
  50. data/test/unit/test_paradeiser_view_report.rb +116 -114
  51. data/test/unit/test_paradeiser_view_status.rb +14 -11
  52. data/test/unit/test_pomodori_controller.rb +319 -316
  53. data/test/unit/test_pomodori_view.rb +40 -37
  54. data/test/unit/test_pomodoro.rb +116 -113
  55. data/test/unit/test_pomodoro_hooks.rb +172 -170
  56. data/test/unit/test_repository.rb +98 -95
  57. data/test/unit/test_scheduler.rb +39 -30
  58. data/test/unit/test_token_file_registry.rb +40 -0
  59. metadata +59 -49
@@ -1,367 +1,370 @@
1
1
  require 'helper'
2
2
 
3
- class TestPomodoriController < ControllerTest
4
- def setup
5
- @backend = PStoreMock.new
6
- end
7
-
8
- def model
9
- 'pomodoro'
10
- end
11
-
12
- def test_start
13
- attrs = invoke(:start, nil, nil, '@pom', 'has_output')
14
- assert_equal(:active, attrs[:pom].status_name)
15
- assert_equal(false, attrs[:has_output])
16
- assert_empty(attrs[:stdout])
17
- assert_empty(attrs[:stderr])
18
- assert_equal(1, @backend.size)
19
- end
20
-
21
- def test_start_verbose
22
- attrs = invoke(:start, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
23
- assert_equal(:active, attrs[:pom].status_name)
24
- assert_equal(false, attrs[:has_output])
25
- refute_empty(attrs[:stdout])
26
- assert_empty(attrs[:stderr])
27
- assert_equal(1, @backend.size)
28
- end
29
-
30
- def test_start_active
31
- invoke(:start)
32
- assert_equal(1, @backend.size)
33
-
34
- assert_raises SingletonError do
35
- invoke(:start)
3
+ module ParadeiserTest
4
+ class TestPomodoriController < ControllerTest
5
+ def setup
6
+ super
7
+ @backend = PStoreMock.new
36
8
  end
37
- assert_equal(1, @backend.size)
38
- end
39
9
 
40
- def test_finish
41
- invoke(:start)
42
- attrs = invoke(:finish, nil, nil, '@pom', 'has_output')
43
- assert_equal(:finished, attrs[:pom].status_name)
44
- assert_equal(false, attrs[:has_output])
45
- assert_empty(attrs[:stdout])
46
- assert_empty(attrs[:stderr])
47
- assert_equal(1, @backend.size)
48
- end
10
+ def model
11
+ 'pomodoro'
12
+ end
49
13
 
50
- def test_finish_verbose
51
- invoke(:start)
52
- attrs = invoke(:finish, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
53
- assert_equal(:finished, attrs[:pom].status_name)
54
- assert_equal(false, attrs[:has_output])
55
- refute_empty(attrs[:stdout])
56
- assert_empty(attrs[:stderr])
57
- assert_equal(1, @backend.size)
58
- end
14
+ def test_start
15
+ attrs = invoke(:start, nil, nil, '@pom', 'has_output')
16
+ assert_equal(:active, attrs[:pom].status_name)
17
+ assert_equal(false, attrs[:has_output])
18
+ assert_empty(attrs[:stdout])
19
+ assert_empty(attrs[:stderr])
20
+ assert_equal(1, @backend.size)
21
+ end
59
22
 
60
- def test_finish_idle
61
- assert_raises NotActiveError do
62
- invoke(:finish)
23
+ def test_start_verbose
24
+ attrs = invoke(:start, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
25
+ assert_equal(:active, attrs[:pom].status_name)
26
+ assert_equal(false, attrs[:has_output])
27
+ refute_empty(attrs[:stdout])
28
+ assert_empty(attrs[:stderr])
29
+ assert_equal(1, @backend.size)
63
30
  end
64
- assert_equal(0, @backend.size)
65
- end
66
31
 
67
- def test_finish_canceled
68
- invoke(:start)
69
- invoke(:cancel)
70
- assert_equal(1, @backend.size)
32
+ def test_start_active
33
+ invoke(:start)
34
+ assert_equal(1, @backend.size)
71
35
 
72
- assert_raises NotActiveError do
73
- invoke(:finish)
36
+ assert_raises SingletonError do
37
+ invoke(:start)
38
+ end
39
+ assert_equal(1, @backend.size)
74
40
  end
75
- assert_equal(1, @backend.size)
76
- assert_equal(:canceled, @backend[@backend.roots.first].status_name)
77
- end
78
41
 
79
- def test_interrupt_idle
80
- assert_raises NotActiveError do
81
- invoke(:interrupt)
42
+ def test_finish
43
+ invoke(:start)
44
+ attrs = invoke(:finish, nil, nil, '@pom', 'has_output')
45
+ assert_equal(:finished, attrs[:pom].status_name)
46
+ assert_equal(false, attrs[:has_output])
47
+ assert_empty(attrs[:stdout])
48
+ assert_empty(attrs[:stderr])
49
+ assert_equal(1, @backend.size)
82
50
  end
83
- assert_equal(0, @backend.size)
84
- end
85
51
 
86
- def test_interrupt_active
87
- invoke(:start)
88
- attrs = invoke(:interrupt, nil, OpenStruct.new, '@pom', 'has_output')
89
- assert_equal(:active, attrs[:pom].status_name)
90
- assert_empty(attrs[:stdout])
91
- assert_empty(attrs[:stderr])
92
-
93
- interrupts = attrs[:pom].interrupts
94
- refute_nil(interrupts)
95
- refute_empty(interrupts)
96
- assert_equal(1, interrupts.size)
97
-
98
- interrupt = interrupts.first
99
- refute_nil(interrupt)
100
- refute_nil(interrupt.created_at)
101
- assert_equal(:internal, interrupt.type)
102
- end
103
-
104
- def test_interrupt_active_verbose
105
- invoke(:start)
106
- attrs = invoke(:interrupt, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
107
- assert_equal(:active, attrs[:pom].status_name)
108
- refute_empty(attrs[:stdout])
109
- assert_empty(attrs[:stderr])
110
- end
111
-
112
- def test_interrupt_active_internal
113
- invoke(:start)
114
- attrs = invoke(:interrupt, nil, OpenStruct.new(:internal => true), '@pom')
115
- interrupt = attrs[:pom].interrupts.first
116
- assert_equal(:internal, interrupt.type)
117
- end
52
+ def test_finish_verbose
53
+ invoke(:start)
54
+ attrs = invoke(:finish, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
55
+ assert_equal(:finished, attrs[:pom].status_name)
56
+ assert_equal(false, attrs[:has_output])
57
+ refute_empty(attrs[:stdout])
58
+ assert_empty(attrs[:stderr])
59
+ assert_equal(1, @backend.size)
60
+ end
118
61
 
119
- def test_interrupt_active_external
120
- invoke(:start)
121
- attrs = invoke(:interrupt, nil, OpenStruct.new(:external => true), '@pom')
122
- interrupt = attrs[:pom].interrupts.first
123
- assert_equal(:external, interrupt.type)
124
- end
62
+ def test_finish_idle
63
+ assert_raises NotActiveError do
64
+ invoke(:finish)
65
+ end
66
+ assert_equal(0, @backend.size)
67
+ end
125
68
 
126
- def test_interrupt_finished
127
- invoke(:start)
128
- invoke(:finish)
129
- assert_equal(1, @backend.size)
69
+ def test_finish_canceled
70
+ invoke(:start)
71
+ invoke(:cancel)
72
+ assert_equal(1, @backend.size)
130
73
 
131
- assert_raises NotActiveError do
132
- invoke(:interrupt)
74
+ assert_raises NotActiveError do
75
+ invoke(:finish)
76
+ end
77
+ assert_equal(1, @backend.size)
78
+ assert_equal(:canceled, @backend[@backend.roots.first].status_name)
133
79
  end
134
80
 
135
- assert_equal(1, @backend.size)
136
- end
137
-
138
- def test_cancel_idle
139
- assert_raises NotActiveError do
140
- invoke(:cancel)
81
+ def test_interrupt_idle
82
+ assert_raises NotActiveError do
83
+ invoke(:interrupt)
84
+ end
85
+ assert_equal(0, @backend.size)
141
86
  end
142
- assert_equal(0, @backend.size)
143
- end
144
87
 
145
- def test_cancel_active
146
- invoke(:start)
147
- attrs = invoke(:cancel, nil, nil, '@pom', 'has_output')
148
- assert_equal(:canceled, attrs[:pom].status_name)
149
- assert_equal(false, attrs[:has_output])
150
- assert_empty(attrs[:stdout])
151
- assert_empty(attrs[:stderr])
152
- assert_equal(1, @backend.size)
153
- end
88
+ def test_interrupt_active
89
+ invoke(:start)
90
+ attrs = invoke(:interrupt, nil, OpenStruct.new, '@pom', 'has_output')
91
+ assert_equal(:active, attrs[:pom].status_name)
92
+ assert_empty(attrs[:stdout])
93
+ assert_empty(attrs[:stderr])
94
+
95
+ interrupts = attrs[:pom].interrupts
96
+ refute_nil(interrupts)
97
+ refute_empty(interrupts)
98
+ assert_equal(1, interrupts.size)
99
+
100
+ interrupt = interrupts.first
101
+ refute_nil(interrupt)
102
+ refute_nil(interrupt.created_at)
103
+ assert_equal(:internal, interrupt.type)
104
+ end
154
105
 
155
- def test_cancel_active_verbose
156
- invoke(:start)
157
- attrs = invoke(:cancel, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
158
- assert_equal(:canceled, attrs[:pom].status_name)
159
- assert_equal(false, attrs[:has_output])
160
- refute_empty(attrs[:stdout])
161
- assert_empty(attrs[:stderr])
162
- assert_equal(1, @backend.size)
163
- end
106
+ def test_interrupt_active_verbose
107
+ invoke(:start)
108
+ attrs = invoke(:interrupt, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
109
+ assert_equal(:active, attrs[:pom].status_name)
110
+ refute_empty(attrs[:stdout])
111
+ assert_empty(attrs[:stderr])
112
+ end
164
113
 
165
- def test_cancel_finished
166
- invoke(:start)
167
- invoke(:finish)
168
- assert_equal(1, @backend.size)
114
+ def test_interrupt_active_internal
115
+ invoke(:start)
116
+ attrs = invoke(:interrupt, nil, OpenStruct.new(:internal => true), '@pom')
117
+ interrupt = attrs[:pom].interrupts.first
118
+ assert_equal(:internal, interrupt.type)
119
+ end
169
120
 
170
- assert_raises NotActiveError do
171
- invoke(:cancel)
121
+ def test_interrupt_active_external
122
+ invoke(:start)
123
+ attrs = invoke(:interrupt, nil, OpenStruct.new(:external => true), '@pom')
124
+ interrupt = attrs[:pom].interrupts.first
125
+ assert_equal(:external, interrupt.type)
172
126
  end
173
127
 
174
- assert_equal(1, @backend.size)
175
- end
128
+ def test_interrupt_finished
129
+ invoke(:start)
130
+ invoke(:finish)
131
+ assert_equal(1, @backend.size)
176
132
 
177
- def test_cancel_again
178
- invoke(:start)
179
- invoke(:cancel)
180
- assert_equal(1, @backend.size)
181
- invoke(:start)
182
- assert_equal(2, @backend.size)
183
- end
133
+ assert_raises NotActiveError do
134
+ invoke(:interrupt)
135
+ end
184
136
 
185
- def test_log_active
186
- invoke(:start)
187
- annotation_args = name.split('_')
188
- attrs = invoke(:log, annotation_args, nil, '@pom', 'has_output')
189
- pom = attrs[:pom]
190
- assert_kind_of(Pomodoro, pom)
191
- assert_equal(:finished, pom.status_name)
192
- end
137
+ assert_equal(1, @backend.size)
138
+ end
193
139
 
194
- def test_log_inactive
195
- annotation_args = name.split('_')
196
- now = srand
140
+ def test_cancel_idle
141
+ assert_raises NotActiveError do
142
+ invoke(:cancel)
143
+ end
144
+ assert_equal(0, @backend.size)
145
+ end
197
146
 
198
- attrs = Time.stub :now, Time.at(now) do
199
- invoke(:log, annotation_args, nil, '@pom', 'has_output')
147
+ def test_cancel_active
148
+ invoke(:start)
149
+ attrs = invoke(:cancel, nil, nil, '@pom', 'has_output')
150
+ assert_equal(:canceled, attrs[:pom].status_name)
151
+ assert_equal(false, attrs[:has_output])
152
+ assert_empty(attrs[:stdout])
153
+ assert_empty(attrs[:stderr])
154
+ assert_equal(1, @backend.size)
200
155
  end
201
156
 
202
- assert(attrs)
203
- pom = attrs[:pom]
204
- assert(pom)
205
- assert_kind_of(Pomodoro, pom)
206
- assert_equal(:finished, pom.status_name)
207
- assert_equal(Time.at(now - Pomodoro::MINUTES_25 * 60), pom.started_at)
208
- assert_equal(Time.at(now), pom.finished_at)
157
+ def test_cancel_active_verbose
158
+ invoke(:start)
159
+ attrs = invoke(:cancel, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
160
+ assert_equal(:canceled, attrs[:pom].status_name)
161
+ assert_equal(false, attrs[:has_output])
162
+ refute_empty(attrs[:stdout])
163
+ assert_empty(attrs[:stderr])
164
+ assert_equal(1, @backend.size)
165
+ end
209
166
 
210
- assert_empty(attrs[:stdout])
211
- assert_empty(attrs[:stderr])
212
- assert_equal(1, @backend.size)
167
+ def test_cancel_finished
168
+ invoke(:start)
169
+ invoke(:finish)
170
+ assert_equal(1, @backend.size)
213
171
 
214
- annotations = attrs[:pom].annotations
215
- assert(annotations)
216
- assert_equal(1, annotations.size)
217
- assert_equal(annotation_args.join(' '), annotations.first)
218
- end
172
+ assert_raises NotActiveError do
173
+ invoke(:cancel)
174
+ end
219
175
 
220
- def test_log_active_verbose
221
- invoke(:start)
222
- attrs = invoke(:log, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
223
- assert_equal(:finished, attrs[:pom].status_name)
224
- assert_equal(false, attrs[:has_output])
225
- refute_empty(attrs[:stdout])
226
- assert_empty(attrs[:stderr])
227
- assert_equal(2, @backend.size)
228
- end
176
+ assert_equal(1, @backend.size)
177
+ end
229
178
 
230
- def test_log_inactive_verbose
231
- attrs = invoke(:log, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
232
- assert_equal(:finished, attrs[:pom].status_name)
233
- assert_equal(false, attrs[:has_output])
234
- refute_empty(attrs[:stdout])
235
- assert_empty(attrs[:stderr])
236
- assert_equal(1, @backend.size)
237
- end
179
+ def test_cancel_again
180
+ invoke(:start)
181
+ invoke(:cancel)
182
+ assert_equal(1, @backend.size)
183
+ invoke(:start)
184
+ assert_equal(2, @backend.size)
185
+ end
238
186
 
239
- def test_annotate_active
240
- invoke(:start)
241
- annotation_args = 'foobar w00t'.split
242
- attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
243
- assert_equal(:active, attrs[:pom].status_name)
244
- assert_equal(false, attrs[:has_output])
245
- assert_empty(attrs[:stdout])
246
- assert_empty(attrs[:stderr])
247
- assert_equal(1, @backend.size)
248
- annotations = attrs[:pom].annotations
249
- assert(annotations)
250
- assert_equal(1, annotations.size)
251
- assert_equal(annotation_args.join(' '), annotations.first)
252
- end
187
+ def test_log_active
188
+ invoke(:start)
189
+ annotation_args = name.split('_')
190
+ attrs = invoke(:log, annotation_args, nil, '@pom', 'has_output')
191
+ pom = attrs[:pom]
192
+ assert_kind_of(Pomodoro, pom)
193
+ assert_equal(:finished, pom.status_name)
194
+ end
253
195
 
254
- def test_annotate_active_verbose
255
- invoke(:start)
256
- attrs = invoke(:annotate, ['annotation', 'args'], OpenStruct.new(:verbose => true), '@pom', 'has_output')
257
- refute_empty(attrs[:stdout])
258
- assert_empty(attrs[:stderr])
259
- end
196
+ def test_log_inactive
197
+ annotation_args = name.split('_')
198
+ now = srand
199
+
200
+ attrs = Time.stub :now, Time.at(now) do
201
+ invoke(:log, annotation_args, nil, '@pom', 'has_output')
202
+ end
203
+
204
+ assert(attrs)
205
+ pom = attrs[:pom]
206
+ assert(pom)
207
+ assert_kind_of(Pomodoro, pom)
208
+ assert_equal(:finished, pom.status_name)
209
+ assert_equal(Time.at(now - Pomodoro::MINUTES_25 * 60), pom.started_at)
210
+ assert_equal(Time.at(now), pom.finished_at)
211
+
212
+ assert_empty(attrs[:stdout])
213
+ assert_empty(attrs[:stderr])
214
+ assert_equal(1, @backend.size)
215
+
216
+ annotations = attrs[:pom].annotations
217
+ assert(annotations)
218
+ assert_equal(1, annotations.size)
219
+ assert_equal(annotation_args.join(' '), annotations.first)
220
+ end
260
221
 
261
- def test_annotate_second_last_successful
262
- invoke(:start)
263
- invoke(:finish)
222
+ def test_log_active_verbose
223
+ invoke(:start)
224
+ attrs = invoke(:log, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
225
+ assert_equal(:finished, attrs[:pom].status_name)
226
+ assert_equal(false, attrs[:has_output])
227
+ refute_empty(attrs[:stdout])
228
+ assert_empty(attrs[:stderr])
229
+ assert_equal(2, @backend.size)
230
+ end
264
231
 
265
- @backend[:foo] = SchedulableMock.new(
266
- :status => 'finished',
267
- :status_name => :finished,
268
- :finished => true,
269
- :name => 'break',
270
- :remaining => 0,
271
- :finished_at => Time.now)
232
+ def test_log_inactive_verbose
233
+ attrs = invoke(:log, nil, OpenStruct.new(:verbose => true), '@pom', 'has_output')
234
+ assert_equal(:finished, attrs[:pom].status_name)
235
+ assert_equal(false, attrs[:has_output])
236
+ refute_empty(attrs[:stdout])
237
+ assert_empty(attrs[:stderr])
238
+ assert_equal(1, @backend.size)
239
+ end
272
240
 
273
- last = Repository.stub :backend, @backend do
274
- Repository.all.last
241
+ def test_annotate_active
242
+ invoke(:start)
243
+ annotation_args = 'foobar w00t'.split
244
+ attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
245
+ assert_equal(:active, attrs[:pom].status_name)
246
+ assert_equal(false, attrs[:has_output])
247
+ assert_empty(attrs[:stdout])
248
+ assert_empty(attrs[:stderr])
249
+ assert_equal(1, @backend.size)
250
+ annotations = attrs[:pom].annotations
251
+ assert(annotations)
252
+ assert_equal(1, annotations.size)
253
+ assert_equal(annotation_args.join(' '), annotations.first)
275
254
  end
276
- assert_kind_of(SchedulableMock, last)
277
255
 
278
- annotation_args = name.split('_')
279
- attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
256
+ def test_annotate_active_verbose
257
+ invoke(:start)
258
+ attrs = invoke(:annotate, ['annotation', 'args'], OpenStruct.new(:verbose => true), '@pom', 'has_output')
259
+ refute_empty(attrs[:stdout])
260
+ assert_empty(attrs[:stderr])
261
+ end
280
262
 
281
- pom = attrs[:pom]
282
- assert_kind_of(Pomodoro, pom)
283
- assert_equal(:finished, pom.status_name)
263
+ def test_annotate_second_last_successful
264
+ invoke(:start)
265
+ invoke(:finish)
284
266
 
285
- annotations = pom.annotations
286
- assert(annotations)
287
- assert_equal(1, annotations.size)
288
- assert_equal(annotation_args.join(' '), annotations.first)
289
- end
267
+ @backend[:foo] = SchedulableMock.new(
268
+ :status => 'finished',
269
+ :status_name => :finished,
270
+ :finished => true,
271
+ :name => 'break',
272
+ :remaining => 0,
273
+ :finished_at => Time.now)
274
+
275
+ last = Repository.stub :backend, @backend do
276
+ Repository.all.last
277
+ end
278
+ assert_kind_of(SchedulableMock, last)
279
+
280
+ annotation_args = name.split('_')
281
+ attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
282
+
283
+ pom = attrs[:pom]
284
+ assert_kind_of(Pomodoro, pom)
285
+ assert_equal(:finished, pom.status_name)
286
+
287
+ annotations = pom.annotations
288
+ assert(annotations)
289
+ assert_equal(1, annotations.size)
290
+ assert_equal(annotation_args.join(' '), annotations.first)
291
+ end
290
292
 
291
- def test_annotate_last_successful
292
- invoke(:start)
293
- invoke(:finish)
294
- annotation_args = name.split('_')
295
- attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
296
- assert_equal(:finished, attrs[:pom].status_name)
297
- assert_equal(false, attrs[:has_output])
298
- assert_empty(attrs[:stdout])
299
- assert_empty(attrs[:stderr])
300
- assert_equal(1, @backend.size)
301
- annotations = attrs[:pom].annotations
302
- assert(annotations)
303
- assert_equal(1, annotations.size)
304
- assert_equal(annotation_args.join(' '), annotations.first)
305
- end
293
+ def test_annotate_last_successful
294
+ invoke(:start)
295
+ invoke(:finish)
296
+ annotation_args = name.split('_')
297
+ attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
298
+ assert_equal(:finished, attrs[:pom].status_name)
299
+ assert_equal(false, attrs[:has_output])
300
+ assert_empty(attrs[:stdout])
301
+ assert_empty(attrs[:stderr])
302
+ assert_equal(1, @backend.size)
303
+ annotations = attrs[:pom].annotations
304
+ assert(annotations)
305
+ assert_equal(1, annotations.size)
306
+ assert_equal(annotation_args.join(' '), annotations.first)
307
+ end
306
308
 
307
- def test_annotate_last_canceled
308
- invoke(:start)
309
- invoke(:cancel)
310
- annotation_args = name.split('_')
311
- attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
312
- assert_equal(:canceled, attrs[:pom].status_name)
313
- assert_equal(false, attrs[:has_output])
314
- assert_empty(attrs[:stdout])
315
- assert_empty(attrs[:stderr])
316
- assert_equal(1, @backend.size)
317
- annotations = attrs[:pom].annotations
318
- assert(annotations)
319
- assert_equal(1, annotations.size)
320
- assert_equal(annotation_args.join(' '), annotations.first)
321
- end
309
+ def test_annotate_last_canceled
310
+ invoke(:start)
311
+ invoke(:cancel)
312
+ annotation_args = name.split('_')
313
+ attrs = invoke(:annotate, annotation_args, nil, '@pom', 'has_output')
314
+ assert_equal(:canceled, attrs[:pom].status_name)
315
+ assert_equal(false, attrs[:has_output])
316
+ assert_empty(attrs[:stdout])
317
+ assert_empty(attrs[:stderr])
318
+ assert_equal(1, @backend.size)
319
+ annotations = attrs[:pom].annotations
320
+ assert(annotations)
321
+ assert_equal(1, annotations.size)
322
+ assert_equal(annotation_args.join(' '), annotations.first)
323
+ end
322
324
 
323
- def test_annotate_finish
324
- invoke(:start)
325
- annotation_args = name.split('_')
326
- attrs = invoke(:finish, annotation_args, nil, '@pom', 'has_output')
327
- assert_equal(:finished, attrs[:pom].status_name)
328
- assert_equal(false, attrs[:has_output])
329
- assert_empty(attrs[:stdout])
330
- assert_empty(attrs[:stderr])
331
- assert_equal(1, @backend.size)
332
- annotations = attrs[:pom].annotations
333
- assert(annotations)
334
- assert_equal(1, annotations.size)
335
- assert_equal(annotation_args.join(' '), annotations.first)
336
- end
325
+ def test_annotate_finish
326
+ invoke(:start)
327
+ annotation_args = name.split('_')
328
+ attrs = invoke(:finish, annotation_args, nil, '@pom', 'has_output')
329
+ assert_equal(:finished, attrs[:pom].status_name)
330
+ assert_equal(false, attrs[:has_output])
331
+ assert_empty(attrs[:stdout])
332
+ assert_empty(attrs[:stderr])
333
+ assert_equal(1, @backend.size)
334
+ annotations = attrs[:pom].annotations
335
+ assert(annotations)
336
+ assert_equal(1, annotations.size)
337
+ assert_equal(annotation_args.join(' '), annotations.first)
338
+ end
337
339
 
338
- def test_annotate_interrupt
339
- invoke(:start)
340
- annotation_args = name.split('_')
341
- attrs = invoke(:interrupt, annotation_args, OpenStruct.new, '@pom', 'has_output')
342
- assert_equal(:active, attrs[:pom].status_name)
343
- assert_equal(false, attrs[:has_output])
344
- assert_empty(attrs[:stdout])
345
- assert_empty(attrs[:stderr])
346
- assert_equal(1, @backend.size)
347
- annotations = attrs[:pom].annotations
348
- assert(annotations)
349
- assert_equal(1, annotations.size)
350
- assert_equal(annotation_args.join(' '), annotations.first)
351
- end
340
+ def test_annotate_interrupt
341
+ invoke(:start)
342
+ annotation_args = name.split('_')
343
+ attrs = invoke(:interrupt, annotation_args, OpenStruct.new, '@pom', 'has_output')
344
+ assert_equal(:active, attrs[:pom].status_name)
345
+ assert_equal(false, attrs[:has_output])
346
+ assert_empty(attrs[:stdout])
347
+ assert_empty(attrs[:stderr])
348
+ assert_equal(1, @backend.size)
349
+ annotations = attrs[:pom].annotations
350
+ assert(annotations)
351
+ assert_equal(1, annotations.size)
352
+ assert_equal(annotation_args.join(' '), annotations.first)
353
+ end
352
354
 
353
- def test_annotate_cancel
354
- invoke(:start)
355
- annotation_args = name.split('_')
356
- attrs = invoke(:cancel, annotation_args, nil, '@pom', 'has_output')
357
- assert_equal(:canceled, attrs[:pom].status_name)
358
- assert_equal(false, attrs[:has_output])
359
- assert_empty(attrs[:stdout])
360
- assert_empty(attrs[:stderr])
361
- assert_equal(1, @backend.size)
362
- annotations = attrs[:pom].annotations
363
- assert(annotations)
364
- assert_equal(1, annotations.size)
365
- assert_equal(annotation_args.join(' '), annotations.first)
355
+ def test_annotate_cancel
356
+ invoke(:start)
357
+ annotation_args = name.split('_')
358
+ attrs = invoke(:cancel, annotation_args, nil, '@pom', 'has_output')
359
+ assert_equal(:canceled, attrs[:pom].status_name)
360
+ assert_equal(false, attrs[:has_output])
361
+ assert_empty(attrs[:stdout])
362
+ assert_empty(attrs[:stderr])
363
+ assert_equal(1, @backend.size)
364
+ annotations = attrs[:pom].annotations
365
+ assert(annotations)
366
+ assert_equal(1, annotations.size)
367
+ assert_equal(annotation_args.join(' '), annotations.first)
368
+ end
366
369
  end
367
370
  end