Instantiate and assign a Layout in the Runner

This commit is contained in:
Thibault Jouan
2015-04-10 07:11:29 +00:00
parent b65e989c38
commit a848e6b936
2 changed files with 20 additions and 3 deletions

View File

@@ -1,8 +1,12 @@
SomeLayout = Class.new
module Uh
module WM
RSpec.describe Runner do
let(:env) { Env.new(StringIO.new) }
subject(:runner) { described_class.new env }
let(:env) do
Env.new(StringIO.new).tap { |o| o.layout_class = SomeLayout }
end
subject(:runner) { described_class.new env }
describe '.run' do
subject(:run) { described_class.run env, stopped: true }
@@ -49,6 +53,17 @@ 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