mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-18 22:48:32 +08:00
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.
27 lines
921 B
Ruby
Vendored
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
|