From 498feb809e2894a1774be2f89cde21bea8be9ea0 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 8 Apr 2015 23:38:32 +0000 Subject: [PATCH] Instanciate Manager with a mandatory Dispatcher --- lib/uh/wm/manager.rb | 5 +++-- lib/uh/wm/runner.rb | 4 ++-- spec/uh/wm/manager_spec.rb | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/uh/wm/manager.rb b/lib/uh/wm/manager.rb index 7dd3b38..1845365 100644 --- a/lib/uh/wm/manager.rb +++ b/lib/uh/wm/manager.rb @@ -3,8 +3,9 @@ module Uh class Manager attr_reader :display - def initialize display = Display.new - @display = display + def initialize events, display = Display.new + @events = events + @display = display end def connect diff --git a/lib/uh/wm/runner.rb b/lib/uh/wm/runner.rb index f7421e8..a4dd118 100644 --- a/lib/uh/wm/runner.rb +++ b/lib/uh/wm/runner.rb @@ -10,10 +10,10 @@ module Uh attr_reader :env, :events, :manager - def initialize env, manager: Manager.new, stopped: false + def initialize env, manager: nil, stopped: false @env = env @events = Dispatcher.new - @manager = manager + @manager = manager || Manager.new(@events) @stopped = stopped end diff --git a/spec/uh/wm/manager_spec.rb b/spec/uh/wm/manager_spec.rb index 95b4544..f145a2f 100644 --- a/spec/uh/wm/manager_spec.rb +++ b/spec/uh/wm/manager_spec.rb @@ -1,8 +1,9 @@ module Uh module WM RSpec.describe Manager do + let(:events) { Dispatcher.new } let(:display) { Display.new } - subject(:manager) { described_class.new display } + subject(:manager) { described_class.new events, display } describe '#initialize' do it 'assigns a new display' do