spec/gush/client_spec.rb in gush-2.1.0 vs spec/gush/client_spec.rb in gush-3.0.0
- old
+ new
@@ -35,10 +35,22 @@
end
end
end
describe "#start_workflow" do
+ context "when there is wait parameter configured" do
+ let(:freeze_time) { Time.utc(2023, 01, 21, 14, 36, 0) }
+
+ it "schedules job execution" do
+ travel_to freeze_time do
+ workflow = WaitableTestWorkflow.create
+ client.start_workflow(workflow)
+ expect(Gush::Worker).to have_a_job_enqueued_at(workflow.id, job_with_id("Prepare"), 5.minutes)
+ end
+ end
+ end
+
it "enqueues next jobs from the workflow" do
workflow = TestWorkflow.create
expect {
client.start_workflow(workflow)
}.to change{ActiveJob::Base.queue_adapter.enqueued_jobs.size}.from(0).to(1)
@@ -111,10 +123,10 @@
end
describe "#persist_job" do
it "persists JSON dump of the job in Redis" do
- job = BobJob.new(name: 'bob')
+ job = BobJob.new(name: 'bob', id: 'abcd123')
client.persist_job('deadbeef', job)
expect(redis.keys("gush.jobs.deadbeef.*").length).to eq(1)
end
end