flor hook vs require:
-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch | |
+ error in Flor::Scheduler#notify | |
#<NameError: uninitialized constant Flor::PoloZeroHook> | |
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:106:in `instantiate' | |
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:67:in `class_to_hook' | |
/Users/jmettraux/w/flor/lib/flor/unit/hook.rb:18:in `to_hook' | |
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:131:in `collect' | |
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:131:in `traps_and_hooks' | |
/Users/jmettraux/w/flor/lib/flor/unit/hooker.rb:65:in `notify' | |
/Users/jmettraux/w/flor/lib/flor/unit/scheduler.rb:385:in `notify' | |
/Users/jmettraux/w/flor/lib/flor/core/executor.rb:455:in `process' | |
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:75:in `block in do_run' | |
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:63:in `times' | |
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:63:in `do_run' | |
/Users/jmettraux/w/flor/lib/flor/unit/executor.rb:36:in `block in run' | |
-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch-sch . |
describe 'hooks' do | |
before :each do | |
FileUtils.mkdir('envs/test/lib/hooks/polo') | |
File.open('envs/test/lib/hooks/polo/zero.rb', 'wb') do |f| | |
f.write(%{ | |
class PoloZeroHook | |
def on(message) | |
message['hello'] = 'world' | |
[] # return empty list of new messages | |
end | |
end | |
}) | |
end | |
File.open('envs/test/lib/hooks/hooks.json', 'wb') do |f| | |
f.write(%{ | |
[ | |
{ point: terminated, consumed: true, require: 'polo/zero.rb', class: 'PoloZeroHook' } | |
] | |
}) | |
end | |
end | |
after :each do | |
FileUtils.rm_rf('envs/test/lib/hooks/polo') | |
FileUtils.rm_f('envs/test/lib/hooks/hooks.json') | |
end | |
they 'may be placed under <env>/lib/hooks' do | |
r = | |
@unit.launch( | |
%{ | |
sequence | |
_ | |
}, | |
wait: true) | |
pp r | |
expect(r).to have_terminated_as_point | |
expect(i.counter).to eq(10) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment