discourse/plugins/discourse-workflows/spec/plugin_helper.rb
Joffrey JAFFEUX 0d647d23ef
DEV: runs manual executions in a job (#40686)
Prior to this change manual executions were run synchronously, this was
causing issues for long running tasks (AI for example) which would
timeout. This change will create an execution with the current draft
data and then start a job to claim that pending execution and run it
inside the job.
2026-06-09 17:44:29 +02:00

27 lines
921 B
Ruby
Vendored

# frozen_string_literal: true
Dir[File.join(__dir__, "support", "**", "*.rb")].each { |f| require f }
module DiscourseWorkflowsSpecHelper
extend ActiveSupport::Concern
included do
before do
SiteSetting.discourse_workflows_enabled = true
SiteSetting.external_system_avatars_url = "https://example.com/avatar/{username}.png"
DiscourseWorkflows::Registry.reset_indexes!
Jobs::DiscourseWorkflows::ExecuteWorkflow.jobs.clear
Jobs::DiscourseWorkflows::ExecuteManualWorkflow.jobs.clear
Jobs::DiscourseWorkflows::ResumeWebhookWaiting.jobs.clear
Jobs::DiscourseWorkflows::ResumeWaitingExecution.jobs.clear
end
end
end
RSpec.configure do |config|
config.define_derived_metadata(file_path: %r{/plugins/discourse-workflows/spec/}) do |metadata|
metadata[:discourse_workflows] = true
end
config.include DiscourseWorkflowsSpecHelper, discourse_workflows: true
end