Fix tests

This commit is contained in:
Jorge Manrubia
2025-09-29 13:13:40 +02:00
parent 859a016a2e
commit 1bb8de8564
14 changed files with 552 additions and 165 deletions
@@ -1,12 +0,0 @@
module WorkflowScoped
extend ActiveSupport::Concern
included do
before_action :set_workflow
end
private
def set_workflow
@workflow = Workflow.find(params[:workflow_id])
end
end
@@ -1,36 +0,0 @@
class Workflows::StagesController < ApplicationController
include WorkflowScoped
before_action :set_stage, only: %i[ edit update destroy ]
def new
@stage = @workflow.stages.new
end
def create
@stage = @workflow.stages.create! stage_params
redirect_to @workflow
end
def edit
end
def update
@stage.update! stage_params
redirect_to @workflow
end
def destroy
@stage.destroy
redirect_to @workflow
end
private
def set_stage
@stage = @workflow.stages.find params[:id]
end
def stage_params
params.require(:workflow_stage).permit(:name, :color)
end
end
-35
View File
@@ -1,35 +0,0 @@
module WorkflowsHelper
def button_to_set_stage(card, stage)
button_to \
tag.span(stage.name, class: "overflow-ellipsis"),
card_staging_path(card, stage_id: stage),
method: :put,
class: [ "workflow-stage btn", { "workflow-stage--current": stage == card.stage } ],
form_class: "flex align-center gap-half",
data: { turbo_frame: "_top" }
end
def stage_color(stage)
stage.color.presence || Card::DEFAULT_COLOR
end
def dependent_collections_sentence(workflow)
if workflow.collections.many?
"It will be removed from #{ workflow.collections.count } collections that are using it."
elsif workflow.collections.one?
"It will be removed from the only collection using it."
else
"It's not being used in any collections."
end
end
def workflow_switch_confirmation_message(workflow, collection)
if workflow == collection.workflow
"Stop using #{workflow.name}? Cards you're working on will lose their current stage."
elsif collection.workflow.present?
"Switch to #{workflow.name}? This will return all cards you're working on to the first stage."
else
nil
end
end
end