taskinator 0.4.2 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/spec_helper.rb CHANGED
@@ -27,6 +27,20 @@ require 'resque'
27
27
  require 'resque_spec'
28
28
  ResqueSpec.disable_ext = false
29
29
 
30
+ require 'active_job'
31
+
32
+ ActiveJob::Base.queue_adapter = :test
33
+
34
+ class ApplicationJob < ActiveJob::Base
35
+ queue_as :not_used
36
+ end
37
+
38
+ # minimum rails gems for rspec/rails
39
+ require 'action_view'
40
+ require 'action_dispatch'
41
+ require 'action_controller'
42
+ require 'rspec/rails'
43
+
30
44
  require 'taskinator'
31
45
 
32
46
  Taskinator.configure do |config|
@@ -44,4 +44,20 @@ describe Taskinator::Api, :redis => true do
44
44
  end
45
45
  end
46
46
 
47
+ describe "#find_process" do
48
+ it {
49
+ # fetch method is covered by persistence spec
50
+ expect(Taskinator::Process).to receive(:fetch) {}
51
+ subject.find_process 'foo:bar:process'
52
+ }
53
+ end
54
+
55
+ describe "#find_task" do
56
+ it {
57
+ # fetch method is covered by persistence spec
58
+ expect(Taskinator::Task).to receive(:fetch) {}
59
+ subject.find_task 'foo:bar:process:baz:task'
60
+ }
61
+ end
62
+
47
63
  end
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe Taskinator::Queues::ActiveJobAdapter, :active_job do
4
+
5
+ it_should_behave_like "a queue adapter", :active_job, Taskinator::Queues::ActiveJobAdapter
6
+
7
+ let(:adapter) { Taskinator::Queues::ActiveJobAdapter }
8
+ let(:uuid) { Taskinator.generate_uuid }
9
+
10
+ subject { adapter.new }
11
+
12
+ describe "CreateProcessWorker" do
13
+ let(:args) { Taskinator::Persistence.serialize(:foo => :bar) }
14
+
15
+ it "enqueues" do
16
+ worker = adapter::CreateProcessWorker
17
+ definition = MockDefinition.create
18
+ subject.enqueue_create_process(definition, uuid, :foo => :bar)
19
+
20
+ expect(worker).to have_been_enqueued.with(definition.name, uuid, args)
21
+ end
22
+
23
+ it "enqueues to specified queue" do
24
+ worker = adapter::CreateProcessWorker
25
+ definition = MockDefinition.create(:other)
26
+
27
+ subject.enqueue_create_process(definition, uuid, :foo => :bar)
28
+
29
+ expect(worker).to have_been_enqueued.with(definition.name, uuid, args).on_queue(:other)
30
+ end
31
+
32
+ it "calls worker" do
33
+ expect_any_instance_of(Taskinator::CreateProcessWorker).to receive(:perform)
34
+ adapter::CreateProcessWorker.new.perform(MockDefinition.create.name, uuid, args)
35
+ end
36
+ end
37
+
38
+ describe "ProcessWorker" do
39
+ it "enqueues processes" do
40
+ worker = adapter::ProcessWorker
41
+ subject.enqueue_process(double('process', :uuid => uuid, :queue => nil))
42
+
43
+ expect(worker).to have_been_enqueued.with(uuid)
44
+ end
45
+
46
+ it "enqueues process to specified queue" do
47
+ worker = adapter::ProcessWorker
48
+ subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
49
+
50
+ expect(worker).to have_been_enqueued.with(uuid).on_queue(:other)
51
+ end
52
+
53
+ it "calls process worker" do
54
+ expect_any_instance_of(Taskinator::ProcessWorker).to receive(:perform)
55
+ adapter::ProcessWorker.new.perform(uuid)
56
+ end
57
+ end
58
+
59
+ describe "TaskWorker" do
60
+ it "enqueues tasks" do
61
+ worker = adapter::TaskWorker
62
+ subject.enqueue_task(double('task', :uuid => uuid, :queue => nil))
63
+
64
+ expect(worker).to have_been_enqueued.with(uuid)
65
+ end
66
+
67
+ it "enqueues task to specified queue" do
68
+ worker = adapter::TaskWorker
69
+ subject.enqueue_task(double('task', :uuid => uuid, :queue => :other))
70
+
71
+ expect(worker).to have_been_enqueued.with(uuid).on_queue(:other)
72
+ end
73
+
74
+ it "calls task worker" do
75
+ expect_any_instance_of(Taskinator::TaskWorker).to receive(:perform)
76
+ adapter::TaskWorker.new.perform(uuid)
77
+ end
78
+ end
79
+
80
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Stefano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -131,13 +131,17 @@ executables:
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
- - ".coveralls.yml"
134
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
135
+ - ".github/ISSUE_TEMPLATE/custom.md"
136
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
137
+ - ".github/workflows/taskinator.yml"
135
138
  - ".gitignore"
136
139
  - ".rspec"
137
140
  - ".ruby-gemset"
138
141
  - ".ruby-version"
139
- - ".travis.yml"
140
142
  - CHANGELOG.md
143
+ - CODE_OF_CONDUCT.md
144
+ - CONTRIBUTING.md
141
145
  - Gemfile
142
146
  - Gemfile.lock
143
147
  - LICENSE.txt
@@ -159,6 +163,7 @@ files:
159
163
  - lib/taskinator/process.rb
160
164
  - lib/taskinator/process_worker.rb
161
165
  - lib/taskinator/queues.rb
166
+ - lib/taskinator/queues/active_job.rb
162
167
  - lib/taskinator/queues/delayed_job.rb
163
168
  - lib/taskinator/queues/resque.rb
164
169
  - lib/taskinator/queues/sidekiq.rb
@@ -200,6 +205,7 @@ files:
200
205
  - spec/taskinator/persistence_spec.rb
201
206
  - spec/taskinator/process_spec.rb
202
207
  - spec/taskinator/process_worker_spec.rb
208
+ - spec/taskinator/queues/active_job_spec.rb
203
209
  - spec/taskinator/queues/delayed_job_spec.rb
204
210
  - spec/taskinator/queues/resque_spec.rb
205
211
  - spec/taskinator/queues/sidekiq_spec.rb
@@ -232,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
238
  - !ruby/object:Gem::Version
233
239
  version: '0'
234
240
  requirements: []
235
- rubygems_version: 3.1.4
241
+ rubygems_version: 3.1.6
236
242
  signing_key:
237
243
  specification_version: 4
238
244
  summary: A simple orchestration library for running complex processes or workflows
@@ -266,6 +272,7 @@ test_files:
266
272
  - spec/taskinator/persistence_spec.rb
267
273
  - spec/taskinator/process_spec.rb
268
274
  - spec/taskinator/process_worker_spec.rb
275
+ - spec/taskinator/queues/active_job_spec.rb
269
276
  - spec/taskinator/queues/delayed_job_spec.rb
270
277
  - spec/taskinator/queues/resque_spec.rb
271
278
  - spec/taskinator/queues/sidekiq_spec.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- os: linux
2
- dist: xenial
3
- language: ruby
4
- cache: bundler
5
-
6
- services:
7
- - redis
8
-
9
- rvm:
10
- - 2.5.8
11
- - 2.6.6
12
- - 2.7.2
13
- - 3.0.0
14
-
15
- script: 'bundle exec rake spec'
16
-
17
- notifications:
18
- email:
19
- recipients:
20
- - virtualstaticvoid@gmail.com
21
- on_failure: change
22
- on_success: never
23
-