From a68aa672b4820439e9a279c3bd79e49b0e4f392c Mon Sep 17 00:00:00 2001 From: pezholio Date: Fri, 24 Jan 2025 14:42:10 +0000 Subject: [PATCH] Rename `WorkflowTest` This class name is already used elsewhere, so causes a `superclass mismatch` error when both tests are run in the same test run. --- .../concerns/workflow_step_test.rb | 44 ++++++++++++++++++ .../app/controllers/concerns/workflow_test.rb | 46 ------------------- 2 files changed, 44 insertions(+), 46 deletions(-) create mode 100644 lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_step_test.rb delete mode 100644 lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_test.rb diff --git a/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_step_test.rb b/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_step_test.rb new file mode 100644 index 00000000000..1957747baae --- /dev/null +++ b/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_step_test.rb @@ -0,0 +1,44 @@ +require "test_helper" + +class ContentBlockManager::ContentBlock::WorkflowStepTest < ActiveSupport::TestCase + extend Minitest::Spec::DSL + + describe ".by_name" do + it "returns a step by its name" do + step = Workflow::Step.by_name("review_links") + + assert_equal step&.name, :review_links + end + end + + describe "#next_step" do + [ + %i[edit_draft review_links], + %i[review_links schedule_publishing], + %i[schedule_publishing internal_note], + %i[internal_note change_note], + %i[change_note review], + %i[review confirmation], + ].each do |current_step, expected_step| + it "returns #{expected_step} step when the current step is #{current_step}" do + step = Workflow::Step.by_name(current_step) + assert_equal step&.next_step&.name, expected_step + end + end + end + + describe "#previous_step" do + [ + %i[review_links edit_draft], + %i[schedule_publishing review_links], + %i[internal_note schedule_publishing], + %i[change_note internal_note], + %i[review change_note], + ].each do |current_step, expected_step| + it "returns #{expected_step} step when the current step is #{current_step}" do + step = Workflow::Step.by_name(current_step) + assert_equal step&.previous_step&.name, expected_step + end + end + end +end diff --git a/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_test.rb b/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_test.rb deleted file mode 100644 index 75f342d90b5..00000000000 --- a/lib/engines/content_block_manager/test/unit/app/controllers/concerns/workflow_test.rb +++ /dev/null @@ -1,46 +0,0 @@ -require "test_helper" - -class ContentBlockManager::ContentBlock::WorkflowTest < ActiveSupport::TestCase - extend Minitest::Spec::DSL - - describe "Step" do - describe ".by_name" do - it "returns a step by its name" do - step = Workflow::Step.by_name("review_links") - - assert_equal step&.name, :review_links - end - end - - describe "#next_step" do - [ - %i[edit_draft review_links], - %i[review_links schedule_publishing], - %i[schedule_publishing internal_note], - %i[internal_note change_note], - %i[change_note review], - %i[review confirmation], - ].each do |current_step, expected_step| - it "returns #{expected_step} step when the current step is #{current_step}" do - step = Workflow::Step.by_name(current_step) - assert_equal step&.next_step&.name, expected_step - end - end - end - - describe "#previous_step" do - [ - %i[review_links edit_draft], - %i[schedule_publishing review_links], - %i[internal_note schedule_publishing], - %i[change_note internal_note], - %i[review change_note], - ].each do |current_step, expected_step| - it "returns #{expected_step} step when the current step is #{current_step}" do - step = Workflow::Step.by_name(current_step) - assert_equal step&.previous_step&.name, expected_step - end - end - end - end -end