taskinator 0.0.18 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +28 -28
- data/README.md +29 -0
- data/Rakefile +5 -0
- data/bin/console +5 -0
- data/lib/taskinator/create_process_worker.rb +5 -2
- data/lib/taskinator/definition/builder.rb +12 -7
- data/lib/taskinator/definition.rb +36 -28
- data/lib/taskinator/executor.rb +4 -4
- data/lib/taskinator/job_worker.rb +5 -10
- data/lib/taskinator/logger.rb +1 -0
- data/lib/taskinator/persistence.rb +74 -36
- data/lib/taskinator/process.rb +75 -49
- data/lib/taskinator/queues/delayed_job.rb +1 -11
- data/lib/taskinator/queues/resque.rb +0 -15
- data/lib/taskinator/queues/sidekiq.rb +1 -14
- data/lib/taskinator/queues.rb +0 -5
- data/lib/taskinator/redis_connection.rb +1 -0
- data/lib/taskinator/task.rb +57 -57
- data/lib/taskinator/task_worker.rb +1 -8
- data/lib/taskinator/version.rb +1 -1
- data/lib/taskinator.rb +7 -6
- data/spec/examples/queue_adapter_examples.rb +0 -10
- data/spec/support/test_definition.rb +4 -0
- data/spec/support/test_flow.rb +2 -0
- data/spec/support/test_flows.rb +54 -3
- data/spec/support/test_queue.rb +41 -6
- data/spec/taskinator/create_process_worker_spec.rb +12 -3
- data/spec/taskinator/definition/builder_spec.rb +39 -9
- data/spec/taskinator/definition_spec.rb +19 -27
- data/spec/taskinator/executor_spec.rb +19 -1
- data/spec/taskinator/job_worker_spec.rb +0 -11
- data/spec/taskinator/persistence_spec.rb +122 -7
- data/spec/taskinator/process_spec.rb +39 -23
- data/spec/taskinator/queues/delayed_job_spec.rb +1 -19
- data/spec/taskinator/queues/resque_spec.rb +1 -22
- data/spec/taskinator/queues/sidekiq_spec.rb +1 -20
- data/spec/taskinator/task_spec.rb +160 -52
- data/spec/taskinator/task_worker_spec.rb +0 -17
- data/spec/taskinator/test_flows_spec.rb +43 -0
- metadata +2 -5
- data/lib/taskinator/process_worker.rb +0 -21
- data/spec/taskinator/process_worker_spec.rb +0 -51
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Taskinator::ProcessWorker do
|
4
|
-
|
5
|
-
def mock_process(paused=false, cancelled=false)
|
6
|
-
double('process', :paused? => paused, :cancelled? => cancelled)
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:uuid) { SecureRandom.uuid }
|
10
|
-
|
11
|
-
subject { Taskinator::ProcessWorker.new(uuid) }
|
12
|
-
|
13
|
-
it "should fetch the process" do
|
14
|
-
process = mock_process
|
15
|
-
expect(Taskinator::Process).to receive(:fetch).with(uuid) { process }
|
16
|
-
allow(process).to receive(:start!)
|
17
|
-
subject.perform
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should start the process" do
|
21
|
-
process = mock_process
|
22
|
-
allow(Taskinator::Process).to receive(:fetch).with(uuid) { process }
|
23
|
-
expect(process).to receive(:start!)
|
24
|
-
subject.perform
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should not start if paused" do
|
28
|
-
process = mock_process(true, false)
|
29
|
-
allow(Taskinator::Process).to receive(:fetch).with(uuid) { process }
|
30
|
-
expect(process).to_not receive(:start!)
|
31
|
-
subject.perform
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should not start if cancelled" do
|
35
|
-
process = mock_process(false, true)
|
36
|
-
allow(Taskinator::Process).to receive(:fetch).with(uuid) { process }
|
37
|
-
expect(process).to_not receive(:start!)
|
38
|
-
subject.perform
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should fail if process raises an error" do
|
42
|
-
process = mock_process
|
43
|
-
allow(Taskinator::Process).to receive(:fetch).with(uuid) { process }
|
44
|
-
allow(process).to receive(:start!) { raise StandardError }
|
45
|
-
expect(process).to receive(:fail!).with(StandardError)
|
46
|
-
expect {
|
47
|
-
subject.perform
|
48
|
-
}.to raise_error(StandardError)
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|