mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-17 04:34:24 +00:00
Use source of truth of url_options for report URLs
The ActionController options were not set in testing nor Sidekiq jobs. The now used config is always set in config/application.rb.
This commit is contained in:
@@ -12,6 +12,6 @@ class ApplicationJob < ActiveJob::Base
|
||||
|
||||
def enable_active_storage_urls
|
||||
ActiveStorage::Current.url_options ||=
|
||||
Rails.application.config.action_controller.default_url_options
|
||||
Rails.application.routes.default_url_options
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ReportJob do
|
||||
include CableReady::Broadcaster
|
||||
|
||||
let(:report_args) {
|
||||
{ report_class:, user:, params:, format:, filename: }
|
||||
}
|
||||
@@ -32,6 +34,19 @@ describe ReportJob do
|
||||
expect_csv_report
|
||||
end
|
||||
|
||||
it "notifies Cable Ready when the report is done" do
|
||||
channel = ScopedChannel.for_id("123")
|
||||
with_channel = report_args.merge(channel:)
|
||||
|
||||
ReportJob.perform_later(**with_channel)
|
||||
|
||||
expect(cable_ready[channel]).to receive(:broadcast).and_call_original
|
||||
|
||||
expect {
|
||||
perform_enqueued_jobs(only: ReportJob)
|
||||
}.to change { ActiveStorage::Blob.count }
|
||||
end
|
||||
|
||||
it "triggers an email when the report is done" do
|
||||
# Setup test data which also triggers emails:
|
||||
report_args
|
||||
|
||||
Reference in New Issue
Block a user