diff --git a/features/actions/log_separator.feature b/features/actions/log_separator.feature new file mode 100644 index 0000000..2dcb6b9 --- /dev/null +++ b/features/actions/log_separator.feature @@ -0,0 +1,9 @@ +Feature: `log_separator' action keyword + + Scenario: logs a separator + Given uhwm is running with this run control file: + """ + key(:f) { log_separator } + """ + When I press the alt+f keys + Then the output must contain "- - - - - - - - - - - - - - - - - - - - - - -" diff --git a/lib/uh/wm/actions_handler.rb b/lib/uh/wm/actions_handler.rb index 8b606f1..01b7ab2 100644 --- a/lib/uh/wm/actions_handler.rb +++ b/lib/uh/wm/actions_handler.rb @@ -38,6 +38,10 @@ module Uh Process.waitpid pid end + def log_separator + log '- ' * 24 + end + def method_missing(m, *args, &block) if respond_to? m meth = layout_method m diff --git a/spec/uh/wm/actions_handler_spec.rb b/spec/uh/wm/actions_handler_spec.rb index b3b4f1e..dcaa238 100644 --- a/spec/uh/wm/actions_handler_spec.rb +++ b/spec/uh/wm/actions_handler_spec.rb @@ -24,6 +24,13 @@ module Uh end end + describe '#log_separator' do + it 'logs a separator' do + expect(env).to receive(:log).with /(?:- ){20,}/ + actions.log_separator + end + end + describe '#layout_*' do it 'delegates messages to the layout with handle_ prefix' do expect(env.layout).to receive :handle_screen_sel