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 Oct 7, 2022
1 parent d4be48e commit ae1ecc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/jobs/order_cycle_opening_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class OrderCycleOpeningJob < 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
7 changes: 7 additions & 0 deletions spec/jobs/order_cycle_opening_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@

OrderCycleOpeningJob.perform_now
end

it "triggers jobs for relating to order cycles opening" do
expect(SubscriptionPlacementJob).to receive(:perform_later).with(oc_opened_now.id)
expect(OrderCycleWebhookJob).to receive(:perform_later).with(oc_opened_now.id, 'order_cycle.opened')

OrderCycleOpeningJob.perform_now
end
end

0 comments on commit ae1ecc3

Please sign in to comment.