Sha256: 44cdef00b200841f1e8312408347e5c2d60b7742f84d4fb314845fcad2346c49
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require File.expand_path("../../spec_helper", __FILE__) module JCukeForker describe TaskManager do let(:worker_path) { '/tmp/jcukeforker-test-socket' } let(:feature) { 'feature:1' } let(:mock_socket) { double('socket', :puts => nil) } it "can register a worker" do UNIXSocket.stub(:open).and_return(mock_socket) expect(mock_socket).to receive(:puts).with({feature: feature}.to_json) task_manager = TaskManager.new [feature] task_manager.on_worker_register worker_path end it "can finish task" do expect(mock_socket).to receive(:puts).with({feature: feature}.to_json) task_manager = TaskManager.new [feature] task_manager.instance_variable_get(:@worker_sockets)[worker_path] = mock_socket task_manager.on_task_finished worker_path, nil, nil end it "can close dead worker" do expect(mock_socket).to receive(:close) task_manager = TaskManager.new [feature] task_manager.instance_variable_get(:@worker_sockets)[worker_path] = mock_socket task_manager.on_worker_dead worker_path end it "can send '__KILL__' when there are no tasks left" do expect(mock_socket).to receive(:puts).with('__KILL__') task_manager = TaskManager.new [] task_manager.instance_variable_get(:@worker_sockets)[worker_path] = mock_socket task_manager.on_task_finished worker_path, nil, nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jcukeforker-0.2.5 | spec/jcukeforker/task_manager_spec.rb |