uh-wm 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/lib/uh/wm/actions_handler.rb +9 -0
  3. data/lib/uh/wm/cli.rb +1 -1
  4. data/lib/uh/wm/client.rb +14 -0
  5. data/lib/uh/wm/env.rb +3 -1
  6. data/lib/uh/wm/env_logging.rb +1 -1
  7. data/lib/uh/wm/launcher.rb +73 -0
  8. data/lib/uh/wm/run_control.rb +10 -0
  9. data/lib/uh/wm/runner.rb +26 -5
  10. data/lib/uh/wm/testing/acceptance_helpers.rb +36 -65
  11. data/lib/uh/wm/testing/x_client.rb +63 -0
  12. data/lib/uh/wm/version.rb +1 -1
  13. data/lib/uh/wm/workers/base.rb +1 -1
  14. data/lib/uh/wm/workers/mux.rb +3 -1
  15. data/lib/uh/wm.rb +5 -3
  16. metadata +9 -111
  17. data/.gitignore +0 -3
  18. data/.rspec +0 -1
  19. data/.travis.yml +0 -15
  20. data/Gemfile +0 -5
  21. data/Guardfile +0 -12
  22. data/LICENSE +0 -30
  23. data/Rakefile +0 -40
  24. data/config/cucumber.yaml +0 -1
  25. data/features/actions/execute.feature +0 -9
  26. data/features/actions/layout_delegation.feature +0 -31
  27. data/features/actions/quit.feature +0 -9
  28. data/features/cli/debug.feature +0 -5
  29. data/features/cli/layout.feature +0 -15
  30. data/features/cli/require.feature +0 -5
  31. data/features/cli/run_control.feature +0 -9
  32. data/features/cli/usage.feature +0 -11
  33. data/features/cli/verbose.feature +0 -5
  34. data/features/cli/version.feature +0 -6
  35. data/features/cli/worker.feature +0 -9
  36. data/features/layout/manage.feature +0 -12
  37. data/features/layout/protocol.feature +0 -56
  38. data/features/layout/unmanage.feature +0 -10
  39. data/features/manager/change.feature +0 -7
  40. data/features/manager/check_other_wm.feature +0 -8
  41. data/features/manager/expose.feature +0 -5
  42. data/features/manager/input_events.feature +0 -8
  43. data/features/manager/manage.feature +0 -14
  44. data/features/manager/unmanage.feature +0 -13
  45. data/features/manager/x_errors.feature +0 -17
  46. data/features/run_control/evaluation.feature +0 -18
  47. data/features/run_control/key.feature +0 -33
  48. data/features/run_control/layout.feature +0 -39
  49. data/features/run_control/modifier.feature +0 -10
  50. data/features/run_control/worker.feature +0 -9
  51. data/features/session/connection.feature +0 -5
  52. data/features/session/termination.feature +0 -12
  53. data/features/steps/filesystem_steps.rb +0 -3
  54. data/features/steps/output_steps.rb +0 -55
  55. data/features/steps/run_control_steps.rb +0 -3
  56. data/features/steps/run_steps.rb +0 -41
  57. data/features/steps/x_steps.rb +0 -58
  58. data/features/support/env.rb +0 -33
  59. data/features/workers/block.feature +0 -15
  60. data/features/workers/mux.feature +0 -15
  61. data/spec/spec_helper.rb +0 -30
  62. data/spec/support/exit_helpers.rb +0 -6
  63. data/spec/support/factories.rb +0 -27
  64. data/spec/support/filesystem_helpers.rb +0 -11
  65. data/spec/uh/wm/actions_handler_spec.rb +0 -35
  66. data/spec/uh/wm/cli_spec.rb +0 -214
  67. data/spec/uh/wm/client_spec.rb +0 -148
  68. data/spec/uh/wm/dispatcher_spec.rb +0 -76
  69. data/spec/uh/wm/env_spec.rb +0 -154
  70. data/spec/uh/wm/manager_spec.rb +0 -386
  71. data/spec/uh/wm/run_control_spec.rb +0 -126
  72. data/spec/uh/wm/runner_spec.rb +0 -196
  73. data/uh-wm.gemspec +0 -26
@@ -1,386 +0,0 @@
1
- module Uh
2
- module WM
3
- RSpec.describe Manager do
4
- let(:block) { proc { } }
5
- let(:window) { mock_window }
6
- let(:client) { build_client window }
7
- let(:events) { Dispatcher.new }
8
- let(:modifier) { :mod1 }
9
- let(:display) { Display.new }
10
- subject(:manager) { described_class.new events, modifier, display }
11
-
12
- it 'has no clients' do
13
- expect(manager.clients).to be_empty
14
- end
15
-
16
- describe '#to_io', :xvfb do
17
- context 'when connected' do
18
- before { manager.connect }
19
-
20
- it 'returns an IO object wrapping the display file descriptor' do
21
- expect(manager.to_io)
22
- .to be_an(IO)
23
- .and have_attributes(fileno: display.fileno)
24
- end
25
- end
26
- end
27
-
28
- describe '#connect', :xvfb do
29
- it 'opens the display' do
30
- expect(manager.display).to receive(:open).and_call_original
31
- manager.connect
32
- end
33
-
34
- it 'emits :connecting event with the display' do
35
- events.on :connecting, &block
36
- expect(block).to receive(:call) do |*args|
37
- expect(args).to eq [display]
38
- end
39
- manager.connect
40
- end
41
-
42
- it 'emits :connected event with the display' do
43
- events.on :connected, &block
44
- expect(block).to receive(:call) do |*args|
45
- expect(args).to eq [display]
46
- end
47
- manager.connect
48
- end
49
-
50
- it 'updates the root window mask in order to manage windows' do
51
- manager.connect
52
- expect(display.root.mask).to eq Events::PROPERTY_CHANGE_MASK |
53
- Events::SUBSTRUCTURE_REDIRECT_MASK |
54
- Events::SUBSTRUCTURE_NOTIFY_MASK |
55
- Events::STRUCTURE_NOTIFY_MASK
56
- end
57
-
58
- context 'when connection fails' do
59
- before { allow(display).to receive(:open) { fail } }
60
-
61
- it 'does not emit :connected event' do
62
- events.on :connected, &block
63
- expect(block).not_to receive :call
64
- manager.connect rescue nil
65
- end
66
- end
67
- end
68
-
69
- describe '#disconnect' do
70
- it 'closes the display' do
71
- expect(display).to receive :close
72
- manager.disconnect
73
- end
74
-
75
- it 'emits :disconnected event' do
76
- allow(display).to receive :close
77
- events.on :disconnected, &block
78
- expect(block).to receive :call
79
- manager.disconnect
80
- end
81
- end
82
-
83
- describe '#flush' do
84
- it 'flushes the display' do
85
- expect(display).to receive :flush
86
- manager.flush
87
- end
88
- end
89
-
90
- describe '#grab_key' do
91
- it 'grabs given key on the display' do
92
- expect(manager.display)
93
- .to receive(:grab_key).with('f', KEY_MODIFIERS[modifier])
94
- manager.grab_key :f
95
- end
96
-
97
- context 'when a modifier is given' do
98
- it 'grabs the key with given modifier' do
99
- expect(manager.display)
100
- .to receive(:grab_key)
101
- .with('f', KEY_MODIFIERS[modifier] | KEY_MODIFIERS[:shift])
102
- manager.grab_key :f, :shift
103
- end
104
- end
105
- end
106
-
107
- describe '#configure' do
108
- context 'with new window' do
109
- it 'sends a configure event to the window with a default geo' do
110
- expect(window)
111
- .to receive(:configure_event).with(build_geo 0, 0, 320, 240)
112
- manager.configure window
113
- end
114
-
115
- context 'when :configure event returns a geo' do
116
- it 'sends a configure event with geo returned by event' do
117
- geo = build_geo 0, 0, 42, 42
118
- events.on(:configure) { geo }
119
- expect(window).to receive(:configure_event).with geo
120
- manager.configure window
121
- end
122
- end
123
- end
124
-
125
- context 'with known window' do
126
- before { manager.clients << client }
127
-
128
- it 'tells the client to configure' do
129
- expect(client).to receive :configure
130
- manager.configure window
131
- end
132
- end
133
- end
134
-
135
- describe '#map' do
136
- let(:display) { instance_spy Display }
137
-
138
- it 'registers a new client wrapping the given window' do
139
- manager.map window
140
- expect(manager.clients[0])
141
- .to be_a(Client)
142
- .and have_attributes(window: window)
143
- end
144
-
145
- it 'registers new client only once for a given window' do
146
- manager.map window
147
- expect { manager.map window }.not_to change { manager.clients }
148
- end
149
-
150
- it 'ignores event when window has override redirect' do
151
- allow(window).to receive(:override_redirect?) { true }
152
- expect { manager.map window }.not_to change { manager.clients }
153
- end
154
-
155
- it 'emits :manage event with the registered client' do
156
- events.on :manage, &block
157
- expect(block).to receive :call do |client|
158
- expect(client)
159
- .to be_a(Client)
160
- .and have_attributes(window: window)
161
- end
162
- manager.map window
163
- end
164
-
165
- it 'listens for property notify events on given window' do
166
- expect(display)
167
- .to receive(:listen_events)
168
- .with window, Events::PROPERTY_CHANGE_MASK
169
- manager.map window
170
- end
171
- end
172
-
173
- describe '#unmap' do
174
- before { manager.clients << client }
175
-
176
- context 'when client unmap count is 0 or less' do
177
- it 'preserves the client unmap count' do
178
- expect { manager.unmap window }.not_to change { client.unmap_count }
179
- end
180
-
181
- it 'unregisters the client' do
182
- manager.unmap window
183
- expect(manager.clients).not_to include client
184
- end
185
-
186
- it 'emits :unmanage event with the client' do
187
- events.on :unmanage, &block
188
- expect(block).to receive(:call).with client
189
- manager.unmap window
190
- end
191
- end
192
-
193
- context 'when client unmap count is strictly positive' do
194
- before { client.unmap_count += 1 }
195
-
196
- it 'does not unregister the client' do
197
- manager.unmap window
198
- expect(manager.clients).to include client
199
- end
200
-
201
- it 'decrements the unmap count' do
202
- manager.unmap window
203
- expect(client.unmap_count).to eq 0
204
- end
205
- end
206
-
207
- context 'with unknown window' do
208
- let(:unknown_window) { window.dup }
209
-
210
- it 'does not change registered clients' do
211
- expect { manager.unmap unknown_window }
212
- .not_to change { manager.clients }
213
- end
214
-
215
- it 'does not emit any event' do
216
- expect(events).not_to receive :emit
217
- manager.unmap unknown_window
218
- end
219
- end
220
- end
221
-
222
- describe '#destroy' do
223
- before { manager.clients << client }
224
-
225
- it 'unregisters the client' do
226
- manager.destroy window
227
- expect(manager.clients).not_to include client
228
- end
229
-
230
- it 'emits :unmanage event with the client' do
231
- events.on :unmanage, &block
232
- expect(block).to receive(:call).with client
233
- manager.destroy window
234
- end
235
-
236
- context 'with unknown window' do
237
- let(:unknown_window) { window.dup }
238
-
239
- it 'does not change registered clients' do
240
- expect { manager.destroy unknown_window }
241
- .not_to change { manager.clients }
242
- end
243
-
244
- it 'does not emit any event' do
245
- expect(events).not_to receive :emit
246
- manager.destroy unknown_window
247
- end
248
- end
249
- end
250
-
251
- describe '#update_properties' do
252
- context 'with known window' do
253
- before { manager.clients << client }
254
-
255
- it 'tells the client to update its window properties' do
256
- expect(client).to receive :update_window_properties
257
- manager.update_properties window
258
- end
259
-
260
- it 'emits :change event with the client' do
261
- events.on :change, &block
262
- expect(block).to receive(:call).with client
263
- manager.update_properties window
264
- end
265
- end
266
-
267
- context 'with unknown window' do
268
- it 'does not emit any event' do
269
- expect(events).not_to receive :emit
270
- manager.update_properties window
271
- end
272
- end
273
- end
274
-
275
- describe '#handle_next_event' do
276
- it 'handles the next available event on display' do
277
- event = double 'event'
278
- allow(display).to receive(:next_event) { event }
279
- expect(manager).to receive(:handle).with(event).once
280
- manager.handle_next_event
281
- end
282
- end
283
-
284
- describe '#handle_pending_events' do
285
- let(:event) { mock_event }
286
-
287
- context 'when an event is pending on display' do
288
- before do
289
- allow(display).to receive(:pending?).and_return true, false
290
- allow(display).to receive(:next_event) { event }
291
- end
292
-
293
- it 'handles the event' do
294
- expect(manager).to receive(:handle).with(event).once
295
- manager.handle_pending_events
296
- end
297
- end
298
-
299
- context 'when multiple events are pending on display' do
300
- before do
301
- allow(display).to receive(:pending?).and_return true, true, false
302
- allow(display).to receive(:next_event) { event }
303
- end
304
-
305
- it 'handles all pending events' do
306
- expect(manager).to receive(:handle).with(event).twice
307
- manager.handle_pending_events
308
- end
309
- end
310
- end
311
-
312
- describe '#handle' do
313
- let(:event) { mock_event }
314
-
315
- it 'emits :xevent event with the X event' do
316
- events.on :xevent, &block
317
- manager.handle event
318
- end
319
-
320
- context 'when key_press event is given' do
321
- let(:mod_mask) { KEY_MODIFIERS[modifier] }
322
- let(:event) { mock_event_key_press 'f', mod_mask }
323
-
324
- it 'emits :key event with the corresponding key' do
325
- events.on(:key, :f) { throw :key_press_code }
326
- expect { manager.handle event }.to throw_symbol :key_press_code
327
- end
328
-
329
- context 'whith shift key modifier' do
330
- let(:mod_mask) { KEY_MODIFIERS[modifier] | KEY_MODIFIERS[:shift] }
331
-
332
- it 'emits :key event with the corresponding key and :shift' do
333
- events.on(:key, :f, :shift) { throw :key_press_code }
334
- expect { manager.handle event }.to throw_symbol :key_press_code
335
- end
336
- end
337
- end
338
-
339
- context 'when configure request event is given' do
340
- let(:event) { mock_event :configure_request, window: :window }
341
-
342
- it 'configures the event window' do
343
- expect(manager).to receive(:configure).with :window
344
- manager.handle event
345
- end
346
- end
347
-
348
- context 'when destroy_notify event is given' do
349
- let(:event) { mock_event :destroy_notify, window: :window }
350
-
351
- it 'destroy the event window' do
352
- expect(manager).to receive(:destroy).with :window
353
- manager.handle event
354
- end
355
- end
356
-
357
- context 'when map_request event is given' do
358
- let(:event) { mock_event :map_request, window: :window }
359
-
360
- it 'maps the event window' do
361
- expect(manager).to receive(:map).with :window
362
- manager.handle event
363
- end
364
- end
365
-
366
- context 'when unmap_notify event is given' do
367
- let(:event) { mock_event :unmap_notify, window: :window }
368
-
369
- it 'unmaps the event window' do
370
- expect(manager).to receive(:unmap).with :window
371
- manager.handle event
372
- end
373
- end
374
-
375
- context 'when property_notify event is given' do
376
- let(:event) { mock_event :property_notify, window: :window }
377
-
378
- it 'updates event window properties' do
379
- expect(manager).to receive(:update_properties).with :window
380
- manager.handle event
381
- end
382
- end
383
- end
384
- end
385
- end
386
- end
@@ -1,126 +0,0 @@
1
- require 'support/filesystem_helpers'
2
-
3
- module Uh
4
- module WM
5
- RSpec.describe RunControl do
6
- include FileSystemHelpers
7
-
8
- let(:env) { Env.new(StringIO.new) }
9
- subject(:rc) { described_class.new env }
10
-
11
- describe '.evaluate' do
12
- around do |example|
13
- with_file ':run_control_code' do |f|
14
- env.rc_path = f.path
15
- example.run
16
- end
17
- end
18
-
19
- it 'builds a new instance with given env' do
20
- expect(described_class).to receive(:new).with(env).and_call_original
21
- described_class.evaluate env
22
- end
23
-
24
- it 'tells the new instance to evaluate run control file content' do
25
- expect(rc)
26
- .to receive(:evaluate).with(':run_control_code', env.rc_path)
27
- allow(described_class).to receive(:new) { rc }
28
- described_class.evaluate env
29
- end
30
-
31
- context 'when run control file is not present' do
32
- before { env.rc_path = 'non_existent_rc_file.rb' }
33
-
34
- it 'does not raise any error' do
35
- expect { described_class.evaluate env }.not_to raise_error
36
- end
37
- end
38
- end
39
-
40
- describe '#evaluate' do
41
- it 'evaluates given code' do
42
- expect { rc.evaluate 'throw :run_control_code', 'some_path' }
43
- .to throw_symbol :run_control_code
44
- end
45
-
46
- it 'provides access to assigned env' do
47
- expect { rc.evaluate 'fail @env.object_id.to_s', 'some_path' }
48
- .to raise_error env.object_id.to_s
49
- end
50
- end
51
-
52
- describe '#modifier' do
53
- it 'updates env modifier' do
54
- rc.modifier :ctrl
55
- expect(env.modifier).to eq :ctrl
56
- end
57
- end
58
-
59
- describe '#key' do
60
- let(:code) { -> { :keybind_code } }
61
-
62
- it 'registers a key binding in the env' do
63
- rc.key :f, &code
64
- expect(env.keybinds.keys).to include :f
65
- end
66
-
67
- it 'registers a combined keys binding in the env' do
68
- rc.key :f, :shift, &code
69
- expect(env.keybinds.keys).to include %i[f shift]
70
- end
71
-
72
- it 'registers given block with the key binding' do
73
- rc.key :f, &code
74
- expect(env.keybinds[:f].call).to eq :keybind_code
75
- end
76
-
77
- it 'translates common key names to equivalent X keysym' do
78
- rc.key :enter, &code
79
- expect(env.keybinds.keys).to include :Return
80
- end
81
-
82
- it 'translates upcased key name to a combination with shift' do
83
- rc.key :F, &code
84
- expect(env.keybinds.keys).to include %i[f shift]
85
- end
86
- end
87
-
88
- describe '#layout' do
89
- context 'when given a class' do
90
- let(:layout_class) { Class.new }
91
-
92
- it 'sets a layout class in the env' do
93
- rc.layout layout_class
94
- expect(env.layout_class).to be layout_class
95
- end
96
-
97
- context 'when given options' do
98
- it 'instantiates the class with given options' do
99
- expect(layout_class).to receive(:new).with(foo: :bar)
100
- rc.layout layout_class, foo: :bar
101
- end
102
- end
103
- end
104
-
105
- context 'when given an object' do
106
- it 'sets a layout instance in the env' do
107
- rc.layout layout = Object.new
108
- expect(env.layout).to eq layout
109
- end
110
- end
111
- end
112
-
113
- describe '#worker' do
114
- it 'sets the worker type in the env' do
115
- rc.worker :some_worker
116
- expect(env.worker[0]).to eq :some_worker
117
- end
118
-
119
- it 'sets the worker options in the env' do
120
- rc.worker :some_worker, some: :option
121
- expect(env.worker[1]).to eq({ some: :option })
122
- end
123
- end
124
- end
125
- end
126
- end
@@ -1,196 +0,0 @@
1
- SomeLayout = Class.new do
2
- include Factories
3
-
4
- define_method(:register) { |*_| }
5
- define_method(:suggest_geo) { build_geo 0, 0, 42, 42 }
6
- define_method(:<<) { |*_| }
7
- define_method(:remove) { |*_| }
8
- define_method(:update) { |*_| }
9
- end
10
-
11
- module Uh
12
- module WM
13
- RSpec.describe Runner do
14
- let(:env) { Env.new(StringIO.new) }
15
- subject(:runner) { described_class.new env }
16
-
17
- before do
18
- env.layout_class = SomeLayout
19
- env.rc_path = 'non_existent_run_control.rb'
20
- end
21
-
22
- it 'has a dispatcher' do
23
- expect(runner.events).to be_a Dispatcher
24
- end
25
-
26
- it 'is not stopped' do
27
- expect(runner).not_to be_stopped
28
- end
29
-
30
- describe '#stopped?' do
31
- context 'when not stopped' do
32
- it 'returns false' do
33
- expect(runner.stopped?).to be false
34
- end
35
- end
36
-
37
- context 'when stopped' do
38
- before { runner.stop! }
39
-
40
- it 'returns true' do
41
- expect(runner.stopped?).to be true
42
- end
43
- end
44
- end
45
-
46
- describe '#stop!' do
47
- it 'sets the runner as stopped' do
48
- expect { runner.stop! }
49
- .to change { runner.stopped? }
50
- .from(false).to(true)
51
- end
52
- end
53
-
54
- describe '#manager' do
55
- it 'returns the manager' do
56
- expect(runner.manager).to be_a Manager
57
- end
58
-
59
- it 'sets the manager modifier as env modifier' do
60
- expect(runner.manager.modifier).to eq env.modifier
61
- end
62
- end
63
-
64
- describe '#evaluate_run_control' do
65
- it 'evaluates the run control file with RunControl and current env' do
66
- expect(RunControl).to receive(:evaluate).with env
67
- runner.evaluate_run_control
68
- end
69
- end
70
-
71
- describe '#register_event_hooks' do
72
- it 'registers quit event hook' do
73
- runner.register_event_hooks
74
- expect(runner).to receive :stop!
75
- runner.events.emit :quit
76
- end
77
-
78
- context 'layout hooks' do
79
- it 'registers for :connected event' do
80
- runner.register_event_hooks
81
- expect(env.layout).to receive(:register).with :display
82
- runner.events.emit :connected, args: :display
83
- end
84
-
85
- it 'registers for :configure event' do
86
- runner.register_event_hooks
87
- expect(runner.events.emit :configure, args: :window)
88
- .to eq build_geo 0, 0, 42, 42
89
- end
90
-
91
- it 'registers for :manage event' do
92
- runner.register_event_hooks
93
- expect(env.layout).to receive(:<<).with :client
94
- runner.events.emit :manage, args: :client
95
- end
96
-
97
- it 'registers for :unmanage event' do
98
- runner.register_event_hooks
99
- expect(env.layout).to receive(:remove).with :client
100
- runner.events.emit :unmanage, args: :client
101
- end
102
-
103
- it 'registers for :change event' do
104
- runner.register_event_hooks
105
- expect(env.layout).to receive(:update).with :client
106
- runner.events.emit :change, args: :client
107
- end
108
- end
109
-
110
- context 'keys hooks' do
111
- it 'registers for :key' do
112
- env.keybinds[:f] = -> { }
113
- runner.register_event_hooks
114
- expect(runner.events[:key, :f]).not_to be_empty
115
- end
116
-
117
- it 'registers for :key with combined key bindings' do
118
- env.keybinds[[:f, :shift]] = -> { }
119
- runner.register_event_hooks
120
- expect(runner.events[:key, :f, :shift]).not_to be_empty
121
- end
122
-
123
- it 'registers code evaluation with the actions handler' do
124
- env.keybinds[:f] = code = proc { }
125
- runner.register_event_hooks
126
- expect(runner.actions).to receive(:evaluate).with code
127
- runner.events.emit :key, :f
128
- end
129
- end
130
- end
131
-
132
- describe '#connect_manager' do
133
- let(:manager) { instance_spy Manager }
134
- subject(:runner) { described_class.new env, manager: manager }
135
-
136
- it 'connects the manager' do
137
- expect(runner.manager).to receive :connect
138
- runner.connect_manager
139
- end
140
-
141
- it 'tells the manager to grab keys for env key bindings' do
142
- env.keybinds[:f] = -> { }
143
- expect(runner.manager).to receive(:grab_key).with :f
144
- runner.connect_manager
145
- end
146
- end
147
-
148
- describe '#worker' do
149
- it 'returns a worker' do
150
- expect(runner.worker).to respond_to :work_events
151
- end
152
-
153
- it 'setups the before_watch callback' do
154
- expect(runner.manager).to receive :handle_pending_events
155
- runner.worker.before_watch.call
156
- end
157
-
158
- it 'setups the read callback' do
159
- expect(runner.manager).to receive :handle_pending_events
160
- runner.worker.on_read.call
161
- end
162
-
163
- it 'setups the read_next callback' do
164
- expect(runner.manager).to receive :handle_next_event
165
- runner.worker.on_read_next.call
166
- end
167
-
168
- it 'setups the timeout callback' do
169
- expect(runner.manager).to receive :flush
170
- runner.worker.on_timeout.call
171
- end
172
- end
173
-
174
- describe '#run_until' do
175
- it 'tells the worker to watch the manager' do
176
- expect(runner.worker).to receive(:watch).with runner.manager
177
- runner.run_until { true }
178
- end
179
-
180
- it 'tells the worker to work events until given block is true' do
181
- block = proc { }
182
- allow(block).to receive(:call).and_return(false, false, false, true)
183
- expect(runner.worker).to receive(:work_events).exactly(3).times
184
- runner.run_until &block
185
- end
186
- end
187
-
188
- describe '#terminate' do
189
- it 'tells the manager to disconnect' do
190
- expect(runner.manager).to receive :disconnect
191
- runner.terminate
192
- end
193
- end
194
- end
195
- end
196
- end