Skip to content

Commit

Permalink
Trigger OrderCycleOpenWebhookJob when order cycle opens
Browse files Browse the repository at this point in the history
It looks so easy now.
  • Loading branch information
dacook committed Feb 7, 2023
1 parent 81eeee1 commit 9cc0b19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/jobs/order_cycle_opened_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class OrderCycleOpenedJob < ApplicationJob
def perform
recently_opened_order_cycles.each do |oc_id|
SubscriptionPlacementJob.perform_later(oc_id)
OrderCycleWebhookJob.perform_later(oc_id, 'order_cycle.opened')
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/jobs/order_cycle_opened_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
expect { OrderCycleOpenedJob.perform_now }
.not_to enqueue_job(SubscriptionPlacementJob).with(oc_opening_soon.id)
end

it "enqueues jobs relating to order cycles opening" do
expect { OrderCycleOpenedJob.perform_now }
.to enqueue_job(SubscriptionPlacementJob).with(oc_opened_now.id)
.and enqueue_job(OrderCycleWebhookJob).with(oc_opened_now.id, 'order_cycle.opened')
end
end

0 comments on commit 9cc0b19

Please sign in to comment.