spec/taskinator/queues/sidekiq_spec.rb in taskinator-0.3.3 vs spec/taskinator/queues/sidekiq_spec.rb in taskinator-0.3.5
- old
+ new
@@ -5,11 +5,11 @@
it_should_behave_like "a queue adapter", :sidekiq, Taskinator::Queues::SidekiqAdapter do
let(:job) { double('job', :get_sidekiq_options => {}) }
end
let(:adapter) { Taskinator::Queues::SidekiqAdapter }
- let(:uuid) { SecureRandom.uuid }
+ let(:uuid) { Taskinator.generate_uuid }
subject { adapter.new }
describe "CreateProcessWorker" do
let(:args) { Taskinator::Persistence.serialize(:foo => :bar) }
@@ -28,9 +28,28 @@
it "calls worker" do
definition = MockDefinition.create
expect_any_instance_of(Taskinator::CreateProcessWorker).to receive(:perform)
adapter::CreateProcessWorker.new.perform(definition.name, uuid, args)
+ end
+ end
+
+ describe "ProcessWorker" do
+ it "enqueues processes" do
+ worker = adapter::ProcessWorker
+ process = double('process', :uuid => uuid, :queue => nil)
+ subject.enqueue_process(process)
+ expect(worker).to have_enqueued_job(process.uuid)
+ end
+
+ it "enqueues process to specified queue" do
+ subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
+ expect(adapter::ProcessWorker).to be_processed_in_x(:other)
+ end
+
+ it "calls process worker" do
+ expect_any_instance_of(Taskinator::ProcessWorker).to receive(:perform)
+ adapter::ProcessWorker.new.perform(uuid)
end
end
describe "TaskWorker" do
it "enqueues tasks" do