paradeiser 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Guardfile +16 -11
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/TODO.md +12 -1
- data/bin/par +5 -2
- data/lib/paradeiser.rb +22 -2
- data/lib/paradeiser/controllers/controller.rb +1 -0
- data/lib/paradeiser/controllers/paradeiser_controller.rb +0 -1
- data/lib/paradeiser/models/hook.rb +4 -0
- data/lib/paradeiser/models/repository.rb +1 -1
- data/lib/paradeiser/models/scheduled.rb +4 -0
- data/lib/paradeiser/version.rb +1 -1
- data/paradeiser.gemspec +1 -6
- data/templates/linux/hooks/after-finish-break +2 -0
- data/templates/linux/hooks/after-finish-pomodoro +2 -0
- data/templates/linux/hooks/after-start-break +2 -0
- data/templates/linux/hooks/after-start-pomodoro +2 -0
- data/templates/mac/hooks/after-finish-break +2 -0
- data/templates/mac/hooks/after-finish-pomodoro +2 -0
- data/templates/mac/hooks/after-start-break +2 -0
- data/templates/mac/hooks/after-start-pomodoro +2 -0
- data/test/helper.rb +14 -36
- data/test/integration/test_annotate.rb +15 -13
- data/test/integration/test_finish.rb +7 -5
- data/test/integration/test_interrupt.rb +7 -5
- data/test/integration/test_log.rb +9 -7
- data/test/integration/test_no_args.rb +5 -3
- data/test/integration/test_start.rb +5 -3
- data/test/integration/test_status.rb +8 -6
- data/test/integration/test_unknown.rb +5 -3
- data/test/lib/controller_test.rb +4 -2
- data/test/lib/integration_test.rb +8 -2
- data/test/lib/paradeiser_controller_test.rb +7 -1
- data/test/lib/token_file_registry.rb +19 -0
- data/test/lib/unit_test.rb +47 -0
- data/test/lib/view_test.rb +13 -8
- data/test/scripts/create-failing-hooks +17 -0
- data/test/scripts/fail +5 -0
- data/test/unit/test_break.rb +43 -40
- data/test/unit/test_break_view.rb +17 -14
- data/test/unit/test_breaks_controller.rb +55 -52
- data/test/unit/test_interrupt.rb +27 -24
- data/test/unit/test_paradeiser_controller_export.rb +103 -100
- data/test/unit/test_paradeiser_controller_init.rb +2 -2
- data/test/unit/test_paradeiser_controller_report.rb +72 -69
- data/test/unit/test_paradeiser_controller_status.rb +78 -75
- data/test/unit/test_paradeiser_view_init.rb +5 -3
- data/test/unit/test_paradeiser_view_report.rb +116 -114
- data/test/unit/test_paradeiser_view_status.rb +14 -11
- data/test/unit/test_pomodori_controller.rb +319 -316
- data/test/unit/test_pomodori_view.rb +40 -37
- data/test/unit/test_pomodoro.rb +116 -113
- data/test/unit/test_pomodoro_hooks.rb +172 -170
- data/test/unit/test_repository.rb +98 -95
- data/test/unit/test_scheduler.rb +39 -30
- data/test/unit/test_token_file_registry.rb +40 -0
- metadata +59 -49
@@ -1,367 +1,370 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
assert_equal(1, @backend.size)
|
32
|
+
def test_start_active
|
33
|
+
invoke(:start)
|
34
|
+
assert_equal(1, @backend.size)
|
71
35
|
|
72
|
-
|
73
|
-
|
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
|
-
|
80
|
-
|
81
|
-
invoke(:
|
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
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
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
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
69
|
+
def test_finish_canceled
|
70
|
+
invoke(:start)
|
71
|
+
invoke(:cancel)
|
72
|
+
assert_equal(1, @backend.size)
|
130
73
|
|
131
|
-
|
132
|
-
|
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
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
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
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
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
|
-
|
171
|
-
invoke(:
|
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
|
-
|
175
|
-
|
128
|
+
def test_interrupt_finished
|
129
|
+
invoke(:start)
|
130
|
+
invoke(:finish)
|
131
|
+
assert_equal(1, @backend.size)
|
176
132
|
|
177
|
-
|
178
|
-
|
179
|
-
|
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
|
-
|
186
|
-
|
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
|
-
|
195
|
-
|
196
|
-
|
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
|
-
|
199
|
-
invoke(:
|
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
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
211
|
-
|
212
|
-
|
167
|
+
def test_cancel_finished
|
168
|
+
invoke(:start)
|
169
|
+
invoke(:finish)
|
170
|
+
assert_equal(1, @backend.size)
|
213
171
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
assert_equal(annotation_args.join(' '), annotations.first)
|
218
|
-
end
|
172
|
+
assert_raises NotActiveError do
|
173
|
+
invoke(:cancel)
|
174
|
+
end
|
219
175
|
|
220
|
-
|
221
|
-
|
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
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
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
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
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
|
-
|
262
|
-
|
263
|
-
|
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
|
-
|
266
|
-
:
|
267
|
-
:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
271
|
-
|
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
|
-
|
274
|
-
|
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
|
-
|
279
|
-
|
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
|
-
|
282
|
-
|
283
|
-
|
263
|
+
def test_annotate_second_last_successful
|
264
|
+
invoke(:start)
|
265
|
+
invoke(:finish)
|
284
266
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
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
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
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
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
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
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
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
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
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
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
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
|