Skip to content

Commit

Permalink
spec for window manager startup
Browse files Browse the repository at this point in the history
  • Loading branch information
niklas committed May 6, 2011
1 parent 0f78ff9 commit a2e9b1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/kopflos/xvfb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def start
sleep @wait
else
start_window_manager
log "starting... #{command.join(' ')}"
exec *command
execute
end
end

Expand Down Expand Up @@ -141,6 +140,11 @@ def lockfile(num=servernum)
"/tmp/.X#{num}-lock"
end

def execute
log "starting... #{command.join(' ')}"
exec *command
end

def kill_server
if @server
Process.kill("USR1", @server)
Expand Down
14 changes: 13 additions & 1 deletion spec/kopflos/xvfb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Kopflos

it "should determine font path on initialization" do
Xvfb.should_receive(:determine_font_path)
Xvfb.new
Xvfb.new :wait => 1
end

describe 'new' do
Expand Down Expand Up @@ -39,6 +39,18 @@ module Kopflos
ENV['XAUTHORITY'].should_not be_empty
ENV['XAUTHORITY'].should_not == xauthority
end

describe "in forked process" do
before :each do
@xvfb.stub!(:authorize).and_return(true)
@xvfb.stub!(:fork).and_return(nil)
@xvfb.stub!(:execute).and_return(true) # not really, should NOT return, it calles Kernel#exec
end
it "should start window manager" do
@xvfb.should_receive(:start_window_manager).and_return(true)
@xvfb.start
end
end
end

end
Expand Down

0 comments on commit a2e9b1c

Please sign in to comment.