Demo nested job spec

This commit is contained in:
David Taylor 2024-04-22 17:40:06 +01:00
parent b971efed8c
commit 24efce9604
No known key found for this signature in database
GPG Key ID: 46904C18B1D3F434
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,10 @@
# frozen_string_literal: true
module Jobs
class InnerJob < ::Jobs::Base
def execute(args)
puts "Starting inner job"
puts "Finishing inner job"
end
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
module Jobs
class OuterJob < ::Jobs::Base
def execute(args)
puts "Starting outer job"
Jobs.enqueue(:inner_job)
puts "Done outer job"
end
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
describe "nested jobs" do
before { Jobs.run_immediately! }
it "works" do
puts "Starting spec"
Jobs.enqueue(:outer_job)
puts "Done spec"
end
end