Implement Manager#to_io
This commit is contained in:
parent
799cb3f5d9
commit
18667e2492
@ -16,6 +16,10 @@ module Uh
|
|||||||
@clients = []
|
@clients = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_io
|
||||||
|
IO.new(@display.fileno)
|
||||||
|
end
|
||||||
|
|
||||||
def connect
|
def connect
|
||||||
@events.emit :connecting, args: @display
|
@events.emit :connecting, args: @display
|
||||||
@display.open
|
@display.open
|
||||||
|
@ -15,6 +15,18 @@ module Uh
|
|||||||
expect(manager.clients).to be_empty
|
expect(manager.clients).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#to_io', :xvfb do
|
||||||
|
context 'when connected' do
|
||||||
|
before { manager.connect }
|
||||||
|
|
||||||
|
it 'returns an IO object wrapping the display file descriptor' do
|
||||||
|
expect(manager.to_io)
|
||||||
|
.to be_an(IO)
|
||||||
|
.and have_attributes(fileno: display.fileno)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#connect', :xvfb do
|
describe '#connect', :xvfb do
|
||||||
it 'opens the display' do
|
it 'opens the display' do
|
||||||
expect(manager.display).to receive(:open).and_call_original
|
expect(manager.display).to receive(:open).and_call_original
|
||||||
|
Loading…
x
Reference in New Issue
Block a user