Sha256: cb96b6d56b32cfa3caf8b1a433790803038586b4ddc4ab0ef7bf46df201d56e4
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
require_relative '../spec_helper' module Kamerling describe TaskDispatcher do describe '#dispatch' do it 'dispatches tasks to free clients and marks them as busy' do addr = fake :addr client = fake :client, addr: addr, uuid: UUID['16B client UUID'] project = fake :project, uuid: UUID['16B project UUID'] task = fake :task, data: 'data', uuid: UUID['16B task UUID'] repos = fake :repos, as: :class, projects: [project] stub(repos).next_task_for(project) { task } stub(repos).free_clients_for(project) { [client] } net_dispatcher = fake :net_dispatcher TaskDispatcher.new(net_dispatcher: net_dispatcher, repos: repos).dispatch net_dispatcher.must_have_received :dispatch, [addr, "DATA#{"\0" * 12}16B client UUID16B project UUID16B task UUIDdata"] client.must_have_received :busy=, [true] repos.must_have_received :<<, [client] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kamerling-0.0.1 | spec/kamerling/task_dispatcher_spec.rb |