mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-11 18:26:50 +00:00
Rename OrderCycleOpenedJob
This name better reflects what it's doing. As this job is scheduled automatically by Sidekiq, I think there shouldn't be any jobs with the old name in redis. So I didn't bother keeping a placholder for the old name. And Clean up unused include
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Trigger jobs for any order cycles that recently opened
|
||||
class OrderCycleOpenedJob < ApplicationJob
|
||||
class TriggerOrderCyclesToOpenJob < ApplicationJob
|
||||
def perform
|
||||
recently_opened_order_cycles.find_each do |order_cycle|
|
||||
OpenOrderCycleJob.perform_later(order_cycle.id)
|
||||
@@ -15,7 +15,7 @@
|
||||
every: "5m"
|
||||
SubscriptionConfirmJob:
|
||||
every: "5m"
|
||||
OrderCycleOpenedJob:
|
||||
TriggerOrderCyclesToOpenJob:
|
||||
every: "5m"
|
||||
OrderCycleClosingJob:
|
||||
every: "5m"
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require_relative '../../engines/dfc_provider/spec/support/authorization_helper'
|
||||
|
||||
RSpec.describe OrderCycleOpenedJob do
|
||||
include AuthorizationHelper
|
||||
|
||||
RSpec.describe TriggerOrderCyclesToOpenJob do
|
||||
let(:oc_opened_before) {
|
||||
create(:simple_order_cycle, orders_open_at: 1.hour.ago)
|
||||
}
|
||||
@@ -17,7 +14,7 @@ RSpec.describe OrderCycleOpenedJob do
|
||||
}
|
||||
|
||||
it "enqueues jobs for recently opened order cycles only" do
|
||||
expect{ OrderCycleOpenedJob.perform_now }
|
||||
expect{ TriggerOrderCyclesToOpenJob.perform_now }
|
||||
.to enqueue_job(OpenOrderCycleJob).with(oc_opened_now.id)
|
||||
.and enqueue_job(OpenOrderCycleJob).with(oc_opened_before.id).exactly(0).times
|
||||
.and enqueue_job(OpenOrderCycleJob).with(oc_opening_soon.id).exactly(0).times
|
||||
Reference in New Issue
Block a user