Force Display test double usage in Runner.run specs

We need to mock Display.new to return a test double with #open
disabled, in order to prevent the manager to initiate real connections
to current display and because we don't want to inject a Display
instance all the way down from Runner to Manager (at least not yet).
This commit is contained in:
Thibault Jouan 2015-04-09 02:43:22 +00:00
parent 199269f046
commit 6f8bb69c92

View File

@ -7,6 +7,11 @@ module Uh
describe '.run' do
subject(:run) { described_class.run env, stopped: true }
before do
allow(Display)
.to receive(:new) { double('display', open: nil).as_null_object }
end
it 'builds a new Runner with given env' do
expect(described_class)
.to receive(:new).with(env, anything).and_call_original