From 687042e5e63b5c8591cd393763cbb04d679a40af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Tue, 17 Dec 2024 14:10:25 +0100 Subject: [PATCH 1/2] undefined method 'field_format' for nil:NilClass --- test/unit/user_patch_test.rb | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index a2f4deae7..8fc67a954 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -28,23 +28,29 @@ class UserPatchTest < RedmineDmsf::Test::UnitTest def test_remove_dmsf_references id = @jsmith.id + ### + puts ">>> #{@jsmith.custom_values.all.size}" + @jsmith.custom_values.each do |custom_value| + assert custom_value + puts ">>> #{custom_value.id}" + puts ">>> #{custom_value.field_format}" + end + ### @jsmith.destroy assert_equal 0, DmsfFileRevisionAccess.where(user_id: id).all.size assert_equal 0, DmsfFileRevision.where(user_id: id).all.size assert_equal 0, DmsfFileRevision.where(dmsf_workflow_assigned_by_user_id: id).all.size assert_equal 0, DmsfFileRevision.where(dmsf_workflow_started_by_user_id: id).all.size assert_equal 0, DmsfFile.where(deleted_by_user_id: id).all.size - # TODO: Expected: 0, Actual: 1 in Easy extension - f = DmsfFolder.where(user_id: id).first - puts "#{f.id}, #{f.title}, #{f.user_id}, #{f.deleted}" if f - # assert_equal 0, DmsfFolder.where(user_id: id).all.size + assert_equal 0, DmsfFolder.where(user_id: id).all.size assert_equal 0, DmsfFolder.where(deleted_by_user_id: id).all.size assert_equal 0, DmsfLink.where(user_id: id).all.size assert_equal 0, DmsfLink.where(deleted_by_user_id: id).all.size - # assert_equal 0, DmsfLock.where(user_id: id).all.size - # assert_equal 0, DmsfWorkflowStepAction.where(author_id: id).all.size - # assert_equal 0, DmsfWorkflowStepAssignment.where(user_id: id).all.size - # assert_equal 0, DmsfWorkflowStep.where(user_id: id).all.size - # assert_equal 0, DmsfWorkflow.where(author_id: id).all.size + assert_equal 0, DmsfLock.where(user_id: id).all.size + assert_equal 0, DmsfWorkflowStepAction.where(author_id: id).all.size + assert_equal 0, DmsfWorkflowStepAssignment.where(user_id: id).all.size + assert_equal 0, DmsfWorkflowStep.where(user_id: id).all.size + assert_equal 0, DmsfWorkflow.where(author_id: id).all.size + assert_equal 0, DmsfFolderPermission.where(object_id: id, object_type: 'User').all.size end end From 2818561261eccd11dbf68217a304a2b42de55374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Tue, 17 Dec 2024 14:16:38 +0100 Subject: [PATCH 2/2] undefined method 'field_format' for nil:NilClass --- test/unit/dmsf_link_test.rb | 2 +- test/unit/user_patch_test.rb | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/test/unit/dmsf_link_test.rb b/test/unit/dmsf_link_test.rb index ec0860173..966d4baec 100644 --- a/test/unit/dmsf_link_test.rb +++ b/test/unit/dmsf_link_test.rb @@ -22,7 +22,7 @@ # Link tests class DmsfLinksTest < RedmineDmsf::Test::UnitTest - fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions + fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values def test_create_folder_link folder_link = DmsfLink.new diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index 8fc67a954..1252567e9 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -24,18 +24,10 @@ class UserPatchTest < RedmineDmsf::Test::UnitTest fixtures :dmsf_links, :dmsf_locks, :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments, :dmsf_workflow_step_actions, :dmsf_folders, - :dmsf_files, :dmsf_file_revisions + :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values def test_remove_dmsf_references id = @jsmith.id - ### - puts ">>> #{@jsmith.custom_values.all.size}" - @jsmith.custom_values.each do |custom_value| - assert custom_value - puts ">>> #{custom_value.id}" - puts ">>> #{custom_value.field_format}" - end - ### @jsmith.destroy assert_equal 0, DmsfFileRevisionAccess.where(user_id: id).all.size assert_equal 0, DmsfFileRevision.where(user_id: id).all.size