Module: Uh::WM::Testing::Headless

Defined in:
lib/uh/wm/testing/headless.rb

Constant Summary collapse

DISPLAY_NAME =
':42'
DISPLAY_SCREEN =
'640x480x24'

Instance Method Summary collapse

Instance Method Details

#with_xvfbObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/uh/wm/testing/headless.rb', line 10

def with_xvfb
  xvfb = Baf::Testing::Process.new %W[
    Xvfb -ac #{DISPLAY_NAME} -screen 0 #{DISPLAY_SCREEN}
  ]
  xvfb.start
  original_display = ENV['DISPLAY']
  ENV['DISPLAY'] = DISPLAY_NAME
  begin
    yield
  ensure
    ENV['DISPLAY'] = original_display
    xvfb.stop
  end
end