iachat/spec/enterprise/jobs/captain/lifecycle/dispatcher_job_spec.rb
Rodribm10 d0d08ed662 feat(lifecycle): implement DispatcherJob
Replace no-op stub with full perform body: find delivery by id, skip if
blank, delegate to Captain::Lifecycle::Dispatcher#call. Add retry_on
with polynomially_longer backoff (3 attempts). Spec covers dispatcher
delegation and graceful skip for missing records.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 09:20:32 -03:00

23 lines
634 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Captain::Lifecycle::DispatcherJob do
let(:delivery) { create(:captain_lifecycle_delivery) }
it 'calls Dispatcher#call' do
dispatcher = instance_double(Captain::Lifecycle::Dispatcher)
expect(Captain::Lifecycle::Dispatcher)
.to receive(:new)
.with(instance_of(Captain::Lifecycle::Delivery))
.and_return(dispatcher)
expect(dispatcher).to receive(:call)
described_class.perform_now(delivery.id)
end
it 'silently skips missing delivery records' do
expect { described_class.perform_now(-1) }.not_to raise_error
end
end