Last active
January 7, 2020 08:59
-
-
Save jmettraux/e81d703e6cd9701c55d5229f93904d6c to your computer and use it in GitHub Desktop.
flor hook vs require:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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