Sha256: d30d2afa4b2256b9e93ef82243c51291f299e8e1327e7ef02865c38f0b7994ff

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module CukeForker
  describe VncListener do
    let(:server)    { mock(VncServer, :display => ":15")    }
    let(:pool)      { mock(VncServerPool)                   }
    let(:worker)    { mock(Worker, :data => OpenStruct.new) }
    let(:listener)  { VncListener.new pool                  }

    it "fetches a display from the pool and assings it to the worker" do
      pool.should_receive(:get).and_return(server)
      worker.data.should_receive(:vnc=).with server

      listener.on_worker_starting worker
    end

    it "releases the display and removes it from the worker" do
      worker.should_receive(:vnc).and_return server
      pool.should_receive(:release).with server
      worker.data.should_receive(:vnc=).with(nil)

      listener.on_worker_finished worker
    end

    it "stops the pool when the run finishes" do
      pool.should_receive(:stop)

      listener.on_run_finished(true)
    end

    it "sets DISPLAY after the worker is forked" do
      worker.data.should_receive(:vnc).and_return(server)
      ENV.should_receive(:[]=).with("DISPLAY", ":15")

      listener.on_worker_forked worker
    end

  end # VncListenerServer
end # CukeForker

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cukeforker-0.0.6 spec/cukeforker/vnc_listener_spec.rb