Use Layout from uh-layout as default

This commit is contained in:
Thibault Jouan
2015-04-10 17:37:19 +00:00
parent 616b14eae2
commit b9b2bff853
5 changed files with 35 additions and 17 deletions

View File

@@ -53,6 +53,24 @@ module Uh
end
end
describe '#layout' do
context 'when a layout class is set' do
let(:some_layout) { Class.new }
before { env.layout_class = some_layout }
it 'returns a new instance of this layout class' do
expect(env.layout).to be_an_instance_of some_layout
end
end
context 'when a layout class is not set' do
it 'returns an instance of the default layout' do
expect(env.layout).to be_an_instance_of ::Uh::Layout
end
end
end
describe '#logger' do
it 'returns a logger' do
expect(env.logger).to be_a Logger

View File

@@ -55,17 +55,6 @@ module Uh
it 'is not stopped' do
expect(runner).not_to be_stopped
end
it 'assigns a new layout instance' do
expect(runner.layout).to be_an_instance_of SomeLayout
end
context 'when the env has no layout set' do
before { env.layout_class = nil }
it 'raises an ArgumentError' do
expect { runner }.to raise_error WM::ArgumentError
end
end
end
describe '#stopped?' do
@@ -101,7 +90,7 @@ module Uh
it 'registers layout hook for :connected event' do
runner.register_event_hooks
expect(runner.layout).to receive(:register).with :display
expect(env.layout).to receive(:register).with :display
runner.events.emit :connected, args: :display
end