From 6f8bb69c9286cf73001e5a3e9f26f141df204419 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 9 Apr 2015 02:43:22 +0000 Subject: [PATCH] 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). --- spec/uh/wm/runner_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/uh/wm/runner_spec.rb b/spec/uh/wm/runner_spec.rb index 7f4a65a..2a46a2d 100644 --- a/spec/uh/wm/runner_spec.rb +++ b/spec/uh/wm/runner_spec.rb @@ -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