Add stopped status notion in Runner

This commit is contained in:
Thibault Jouan 2015-04-08 21:44:04 +00:00
parent 44a69b75c6
commit b354ffcd62
2 changed files with 36 additions and 0 deletions

View File

@ -15,6 +15,14 @@ module Uh
@manager = manager
end
def stopped?
!!@stopped
end
def stop!
@stopped = true
end
def connect_manager
@manager.connect
@env.log "Connected to X server"

View File

@ -28,6 +28,34 @@ module Uh
it 'assigns a new Manager' do
expect(runner.manager).to be_a Manager
end
it 'is not stopped' do
expect(runner).not_to be_stopped
end
end
describe '#stopped?' do
context 'when not stopped' do
it 'returns false' do
expect(runner.stopped?).to be false
end
end
context 'when stopped' do
before { runner.stop! }
it 'returns true' do
expect(runner.stopped?).to be true
end
end
end
describe '#stop!' do
it 'sets the runner as stopped' do
expect { runner.stop! }
.to change { runner.stopped? }
.from(false).to(true)
end
end
describe '#connect_manager' do