Implement `log_separator' action keyword

This commit is contained in:
Thibault Jouan 2015-04-28 10:45:56 +00:00
parent 85e5abac8d
commit 92dedd16e7
3 changed files with 20 additions and 0 deletions

View File

@ -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 "- - - - - - - - - - - - - - - - - - - - - - -"

View File

@ -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

View File

@ -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