Rename Manager#manage as Manager#map

This commit is contained in:
Thibault Jouan 2015-04-20 07:14:55 +00:00
parent d8994dc165
commit f15fa116c9
2 changed files with 11 additions and 11 deletions

View File

@ -55,7 +55,7 @@ module Uh
end end
end end
def manage window def map window
return if window.override_redirect? || client_for(window) return if window.override_redirect? || client_for(window)
@clients << client = Client.new(window) @clients << client = Client.new(window)
@events.emit :manage, args: client @events.emit :manage, args: client
@ -94,7 +94,7 @@ module Uh
end end
def handle_map_request event def handle_map_request event
manage event.window map event.window
end end
def client_for window def client_for window

View File

@ -126,7 +126,7 @@ module Uh
end end
context 'with known window' do context 'with known window' do
before { manager.manage window } before { manager.map window }
it 'tells the client to configure' do it 'tells the client to configure' do
expect(manager.clients[0]).to receive :configure expect(manager.clients[0]).to receive :configure
@ -135,22 +135,22 @@ module Uh
end end
end end
describe '#manage' do describe '#map' do
it 'registers a new client wrapping the given window' do it 'registers a new client wrapping the given window' do
manager.manage window manager.map window
expect(manager.clients[0]) expect(manager.clients[0])
.to be_a(Client) .to be_a(Client)
.and have_attributes(window: window) .and have_attributes(window: window)
end end
it 'registers new client only once for a given window' do it 'registers new client only once for a given window' do
manager.manage window manager.map window
expect { manager.manage window }.not_to change { manager.clients } expect { manager.map window }.not_to change { manager.clients }
end end
it 'ignores event when window has override redirect' do it 'ignores event when window has override redirect' do
allow(window).to receive(:override_redirect?) { true } allow(window).to receive(:override_redirect?) { true }
expect { manager.manage window }.not_to change { manager.clients } expect { manager.map window }.not_to change { manager.clients }
end end
it 'emits :manage event with the registered client' do it 'emits :manage event with the registered client' do
@ -160,7 +160,7 @@ module Uh
.to be_a(Client) .to be_a(Client)
.and have_attributes(window: window) .and have_attributes(window: window)
end end
manager.manage window manager.map window
end end
end end
@ -236,8 +236,8 @@ module Uh
context 'when map_request event is given' do context 'when map_request event is given' do
let(:event) { double 'event', type: :map_request, window: :window } let(:event) { double 'event', type: :map_request, window: :window }
it 'manages the event window' do it 'maps the event window' do
expect(manager).to receive(:manage).with :window expect(manager).to receive(:map).with :window
manager.handle event manager.handle event
end end
end end