taskinator 0.0.18 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/Gemfile.lock +28 -28
  4. data/README.md +29 -0
  5. data/Rakefile +5 -0
  6. data/bin/console +5 -0
  7. data/lib/taskinator/create_process_worker.rb +5 -2
  8. data/lib/taskinator/definition/builder.rb +12 -7
  9. data/lib/taskinator/definition.rb +36 -28
  10. data/lib/taskinator/executor.rb +4 -4
  11. data/lib/taskinator/job_worker.rb +5 -10
  12. data/lib/taskinator/logger.rb +1 -0
  13. data/lib/taskinator/persistence.rb +74 -36
  14. data/lib/taskinator/process.rb +75 -49
  15. data/lib/taskinator/queues/delayed_job.rb +1 -11
  16. data/lib/taskinator/queues/resque.rb +0 -15
  17. data/lib/taskinator/queues/sidekiq.rb +1 -14
  18. data/lib/taskinator/queues.rb +0 -5
  19. data/lib/taskinator/redis_connection.rb +1 -0
  20. data/lib/taskinator/task.rb +57 -57
  21. data/lib/taskinator/task_worker.rb +1 -8
  22. data/lib/taskinator/version.rb +1 -1
  23. data/lib/taskinator.rb +7 -6
  24. data/spec/examples/queue_adapter_examples.rb +0 -10
  25. data/spec/support/test_definition.rb +4 -0
  26. data/spec/support/test_flow.rb +2 -0
  27. data/spec/support/test_flows.rb +54 -3
  28. data/spec/support/test_queue.rb +41 -6
  29. data/spec/taskinator/create_process_worker_spec.rb +12 -3
  30. data/spec/taskinator/definition/builder_spec.rb +39 -9
  31. data/spec/taskinator/definition_spec.rb +19 -27
  32. data/spec/taskinator/executor_spec.rb +19 -1
  33. data/spec/taskinator/job_worker_spec.rb +0 -11
  34. data/spec/taskinator/persistence_spec.rb +122 -7
  35. data/spec/taskinator/process_spec.rb +39 -23
  36. data/spec/taskinator/queues/delayed_job_spec.rb +1 -19
  37. data/spec/taskinator/queues/resque_spec.rb +1 -22
  38. data/spec/taskinator/queues/sidekiq_spec.rb +1 -20
  39. data/spec/taskinator/task_spec.rb +160 -52
  40. data/spec/taskinator/task_worker_spec.rb +0 -17
  41. data/spec/taskinator/test_flows_spec.rb +43 -0
  42. metadata +2 -5
  43. data/lib/taskinator/process_worker.rb +0 -21
  44. 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