Test and fix setting workflow to nothing
This commit is contained in:
@@ -13,6 +13,6 @@ module Collection::Workflowing
|
||||
|
||||
private
|
||||
def set_all_cards_to_initial_workflow_stage
|
||||
cards.update_all(stage_id: initial_workflow_stage.id)
|
||||
cards.update_all(stage_id: initial_workflow_stage&.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,4 +5,9 @@ class Collection::WorkflowingTest < ActiveSupport::TestCase
|
||||
collections(:writebook).update! workflow: workflows(:on_call)
|
||||
assert_equal [ collections(:writebook).initial_workflow_stage ], collections(:writebook).cards.reload.collect(&:stage).uniq
|
||||
end
|
||||
|
||||
test "remove stage from cards if workflow is removed" do
|
||||
collections(:writebook).update! workflow: nil
|
||||
assert_equal [], collections(:writebook).cards.reload.collect(&:stage).compact
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user