Rename :display, :* events as :*

This commit is contained in:
Thibault Jouan 2015-04-10 07:52:41 +00:00
parent 325801a037
commit 59e9562279
4 changed files with 11 additions and 11 deletions

View File

@ -9,9 +9,9 @@ module Uh
end end
def connect def connect
@events.emit :display, :connecting, args: @display @events.emit :connecting, args: @display
@display.open @display.open
@events.emit :display, :connected, args: @display @events.emit :connected, args: @display
end end
def grab_key keysym def grab_key keysym

View File

@ -45,10 +45,10 @@ module Uh
private private
def register_manager_hooks def register_manager_hooks
@events.on(:display, :connecting) do |display| @events.on(:connecting) do |display|
@env.log_debug "Connecting to X server on `#{display}'" @env.log_debug "Connecting to X server on `#{display}'"
end end
@events.on(:display, :connected) do |display| @events.on(:connected) do |display|
@env.log "Connected to X server on `#{display}'" @env.log "Connected to X server on `#{display}'"
end end
end end

View File

@ -19,16 +19,16 @@ module Uh
manager.connect manager.connect
end end
it 'emits :display, :connecting event with the display' do it 'emits :connecting event with the display' do
events.on :display, :connecting, &block events.on :connecting, &block
expect(block).to receive(:call) do |*args| expect(block).to receive(:call) do |*args|
expect(args).to eq [display] expect(args).to eq [display]
end end
manager.connect manager.connect
end end
it 'emits :display, :connected event with the display' do it 'emits :connected event with the display' do
events.on :display, :connected, &block events.on :connected, &block
expect(block).to receive(:call) do |*args| expect(block).to receive(:call) do |*args|
expect(args).to eq [display] expect(args).to eq [display]
end end
@ -38,8 +38,8 @@ module Uh
context 'when connection fails' do context 'when connection fails' do
before { allow(display).to receive(:open) { fail } } before { allow(display).to receive(:open) { fail } }
it 'does not emit :display, :connected event' do it 'does not emit :connected event' do
events.on :display, :connected, &block events.on :connected, &block
expect(block).not_to receive :call expect(block).not_to receive :call
manager.connect rescue nil manager.connect rescue nil
end end

View File

@ -79,7 +79,7 @@ module Uh
it 'registers manager event hooks for logging' do it 'registers manager event hooks for logging' do
runner.register_event_hooks runner.register_event_hooks
expect(env).to receive(:log) expect(env).to receive(:log)
runner.events.emit :display, :connected runner.events.emit :connected
end end
it 'registers key bindings event hooks' do it 'registers key bindings event hooks' do