From 94497261f932eb7be4e2d75a7988f44d484b47b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Mon, 7 Jul 2025 13:05:12 +0200 Subject: [PATCH 1/7] v3.0.2 devel started --- .github/workflows/rubyonrails.yml | 4 ++-- CHANGELOG.md | 3 +++ README.md | 4 ++-- init.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index bbb0561..af05097 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -20,9 +20,9 @@ name: "GitHub CI" on: push: - branches: ["master"] + branches: ["devel"] pull_request: - branches: ["master"] + branches: ["devel"] jobs: plugin_tests: strategy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 979be81..c25cc20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog for Custom Workflows +3.0.1 *????-??-??* +------------------ + 3.0.1 *2025-07-07* ------------------ SQL Server compatibility diff --git a/README.md b/README.md index 060cd6a..e028162 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Custom Workflows plug-in 3.0.1 +# Custom Workflows plug-in 3.0.2 devel -[![GitHub CI](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml/badge.svg?branch=master)](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml) +[![GitHub CI](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml/badge.svg?branch=devel)](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml) [![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine) This plug-in provides a great functionality for those who is familiar with the Ruby language. diff --git a/init.rb b/init.rb index 56599a9..f1c4621 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,7 @@ Redmine::Plugin.register :redmine_custom_workflows do author_url 'https://github.com/anteo/redmine_custom_workflows/graphs/contributors' author 'Anton Argirov/Karel Pičman' description 'It allows to create custom workflows for objects, defined in a plain Ruby language' - version '3.0.1' + version '3.0.2 devel' requires_redmine version_or_higher: '6.0.0' From 5cae951d24e7da0fca97b64fc0269e45c535d564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Mon, 7 Jul 2025 13:12:26 +0200 Subject: [PATCH 2/7] v3.0.2 devel started --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c25cc20..2b96ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Changelog for Custom Workflows -3.0.1 *????-??-??* +3.0.2 *????-??-??* ------------------ 3.0.1 *2025-07-07* ------------------ SQL Server compatibility + Change of the license from GNU GPL v2 to v3 * New: #360 - GNU GPL v2 -> v3 * Bug: #359 - Can't install plugin with redmine 6.0.5 in docker container From 6bf436f19f3f1e13aebff6f017d86ec5a19f0707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Mon, 29 Sep 2025 12:13:51 +0200 Subject: [PATCH 3/7] fixtures :all --- .rubocop.yml | 3 +-- .../attachments_controller_patch_test.rb | 2 -- .../custom_workflows_controller_test.rb | 1 - .../groups_controller_patch_test.rb | 1 - .../issue_relations_controller_patch_test.rb | 3 --- .../issues_controller_patch_test.rb | 3 --- .../members_controller_patch_test.rb | 1 - .../projects_controller_patch_test.rb | 2 -- .../timelog_controller_patch_test.rb | 3 --- .../functional/users_controller_patch_test.rb | 1 - .../versions_controller_patch_test.rb | 1 - test/functional/wiki_controller_patch_test.rb | 3 --- test/test_case.rb | 20 +++++++------------ test/unit/attachment_patch_test.rb | 1 - test/unit/custom_workflow_mailer_test.rb | 1 - test/unit/custom_workflow_test.rb | 1 - test/unit/group_patch_test.rb | 1 - test/unit/issue_patch_test.rb | 1 - test/unit/issue_relation_patch_test.rb | 1 - test/unit/member_patch_test.rb | 1 - test/unit/project_patch_test.rb | 1 - test/unit/time_entry_patch_test.rb | 1 - test/unit/user_patch_test.rb | 1 - test/unit/version_patch_test.rb | 1 - test/unit/wiki_content_patch_test.rb | 1 - test/unit/wiki_page_patch_test.rb | 1 - test/unit_test.rb | 17 ++++++++-------- 27 files changed, 17 insertions(+), 57 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index df9fb02..9b33bef 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -24,8 +24,7 @@ AllCops: Exclude: - '**/vendor/**/*' -# Enable extensions -require: +plugins: - rubocop-performance - rubocop-rails diff --git a/test/functional/attachments_controller_patch_test.rb b/test/functional/attachments_controller_patch_test.rb index 3923c97..8da9256 100644 --- a/test/functional/attachments_controller_patch_test.rb +++ b/test/functional/attachments_controller_patch_test.rb @@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Attachment controller patch test class AttachmentsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :attachments, :enabled_modules, :custom_workflows, :custom_workflows_projects, - :roles, :members, :member_roles def setup super diff --git a/test/functional/custom_workflows_controller_test.rb b/test/functional/custom_workflows_controller_test.rb index 908df79..29e32f8 100644 --- a/test/functional/custom_workflows_controller_test.rb +++ b/test/functional/custom_workflows_controller_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Custom workflows controller test class CustomWorkflowsControllerTest < RedmineCustomWorkflows::Test::TestCase - fixtures :custom_workflows def setup super diff --git a/test/functional/groups_controller_patch_test.rb b/test/functional/groups_controller_patch_test.rb index 58ffb9f..4e1d9b5 100644 --- a/test/functional/groups_controller_patch_test.rb +++ b/test/functional/groups_controller_patch_test.rb @@ -22,7 +22,6 @@ require File.expand_path('../../test_helper', __FILE__) # Group controller patch test class GroupControllerPatchTest < RedmineCustomWorkflows::Test::TestCase include Rails.application.routes.url_helpers - fixtures :custom_workflows, :custom_workflows_projects def setup super diff --git a/test/functional/issue_relations_controller_patch_test.rb b/test/functional/issue_relations_controller_patch_test.rb index 2bd7a97..78c0149 100644 --- a/test/functional/issue_relations_controller_patch_test.rb +++ b/test/functional/issue_relations_controller_patch_test.rb @@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue relation controller patch test class IssueRelationsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :issue_statuses, - :enabled_modules, :enumerations, :issue_categories, :custom_workflows, :custom_workflows_projects, - :issue_relations, :roles, :members, :member_roles, :attachments def setup super diff --git a/test/functional/issues_controller_patch_test.rb b/test/functional/issues_controller_patch_test.rb index 7886ca0..1f6e5c7 100644 --- a/test/functional/issues_controller_patch_test.rb +++ b/test/functional/issues_controller_patch_test.rb @@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue controller patch test class IssuesControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :issue_statuses, - :enabled_modules, :enumerations, :issue_categories, :custom_workflows, :custom_workflows_projects, :roles, - :members, :member_roles def setup super diff --git a/test/functional/members_controller_patch_test.rb b/test/functional/members_controller_patch_test.rb index 3108d77..6bfc94b 100644 --- a/test/functional/members_controller_patch_test.rb +++ b/test/functional/members_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Users controller patch test class MembersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :roles, :members, :member_roles, :custom_workflows, :custom_workflows_projects def setup super diff --git a/test/functional/projects_controller_patch_test.rb b/test/functional/projects_controller_patch_test.rb index 8ec8fad..adc5733 100644 --- a/test/functional/projects_controller_patch_test.rb +++ b/test/functional/projects_controller_patch_test.rb @@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Project controller patch test class ProjectsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :enabled_modules, - :enumerations, :custom_workflows, :custom_workflows_projects, :roles, :members, :member_roles def setup super diff --git a/test/functional/timelog_controller_patch_test.rb b/test/functional/timelog_controller_patch_test.rb index 851f502..8e6df31 100644 --- a/test/functional/timelog_controller_patch_test.rb +++ b/test/functional/timelog_controller_patch_test.rb @@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Time controller patch test class TimelogControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :issue_statuses, - :enabled_modules, :enumerations, :issue_categories, :custom_workflows, :custom_workflows_projects, - :time_entries, :roles, :members, :member_roles def setup super diff --git a/test/functional/users_controller_patch_test.rb b/test/functional/users_controller_patch_test.rb index 54bbcf5..1d8d4a1 100644 --- a/test/functional/users_controller_patch_test.rb +++ b/test/functional/users_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Users controller patch test class UsersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :custom_workflows, :custom_workflows_projects def setup super diff --git a/test/functional/versions_controller_patch_test.rb b/test/functional/versions_controller_patch_test.rb index 6b9dc3b..43fbbf3 100644 --- a/test/functional/versions_controller_patch_test.rb +++ b/test/functional/versions_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Version controller patch test class VersionsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :versions, :custom_workflows, :custom_workflows_projects, :roles, :members, :member_roles def setup super diff --git a/test/functional/wiki_controller_patch_test.rb b/test/functional/wiki_controller_patch_test.rb index 48c89f7..2288c95 100644 --- a/test/functional/wiki_controller_patch_test.rb +++ b/test/functional/wiki_controller_patch_test.rb @@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki controller patch test class WikiControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :enabled_modules, - :enumerations, :wikis, :wiki_pages, :wiki_contents, :custom_workflows, :custom_workflows_projects, - :roles, :members, :member_roles def setup super diff --git a/test/test_case.rb b/test/test_case.rb index e5229d0..69eeb9b 100644 --- a/test/test_case.rb +++ b/test/test_case.rb @@ -21,22 +21,16 @@ module RedmineCustomWorkflows module Test # Test case base class class TestCase < ActionDispatch::IntegrationTest - fixtures :users, :email_addresses, :projects - # Allow us to override the fixtures method to implement fixtures for our plugin. - # Ultimately it allows for better integration without blowing redmine fixtures up, - # and allowing us to suppliment redmine fixtures if we need to. - def self.fixtures(*table_names) + def initialize(name) + super(name) + # Load all plugin's fixtures dir = File.join(File.dirname(__FILE__), 'fixtures') - redmine_table_names = [] - table_names.each do |x| - if File.exist?(File.join(dir, "#{x}.yml")) - ActiveRecord::FixtureSet.create_fixtures(dir, x) - else - redmine_table_names << x - end + ext = '.yml' + Dir.glob("#{dir}/**/*#{ext}").each do |file| + fixture = File.basename(file, ext) + ActiveRecord::FixtureSet.create_fixtures dir, fixture end - super(redmine_table_names) if redmine_table_names.any? end def setup diff --git a/test/unit/attachment_patch_test.rb b/test/unit/attachment_patch_test.rb index 2ff4c7f..a1f694b 100644 --- a/test/unit/attachment_patch_test.rb +++ b/test/unit/attachment_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Attachment patch test class class AttachmentPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :attachments def setup @attachment1 = Attachment.find 1 diff --git a/test/unit/custom_workflow_mailer_test.rb b/test/unit/custom_workflow_mailer_test.rb index 9df57be..0a3db3d 100644 --- a/test/unit/custom_workflow_mailer_test.rb +++ b/test/unit/custom_workflow_mailer_test.rb @@ -22,7 +22,6 @@ require File.expand_path('../../test_helper', __FILE__) # Custom mailer test class class CustomWorkflowMailerTest < RedmineCustomWorkflows::Test::UnitTest include Redmine::I18n - fixtures :users, :email_addresses def setup @user2 = User.find 2 diff --git a/test/unit/custom_workflow_test.rb b/test/unit/custom_workflow_test.rb index c49c353..f8f0250 100644 --- a/test/unit/custom_workflow_test.rb +++ b/test/unit/custom_workflow_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Custom workflow test class class CustomWorkflowTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :projects, :custom_workflows, :custom_workflows_projects def setup @cw1 = CustomWorkflow.find 1 diff --git a/test/unit/group_patch_test.rb b/test/unit/group_patch_test.rb index e1b934c..9b29cf6 100644 --- a/test/unit/group_patch_test.rb +++ b/test/unit/group_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Group patch test class class GroupPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :users def setup @group10 = Group.find 10 diff --git a/test/unit/issue_patch_test.rb b/test/unit/issue_patch_test.rb index 7d43c9e..d1ca580 100644 --- a/test/unit/issue_patch_test.rb +++ b/test/unit/issue_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue patch test class class IssuePatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :issues def setup @issue1 = Issue.find 1 diff --git a/test/unit/issue_relation_patch_test.rb b/test/unit/issue_relation_patch_test.rb index 6bcc55f..8193ecf 100644 --- a/test/unit/issue_relation_patch_test.rb +++ b/test/unit/issue_relation_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue relation patch test class class IssueRelationPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :issue_relations def setup @issue_relation1 = IssueRelation.find 1 diff --git a/test/unit/member_patch_test.rb b/test/unit/member_patch_test.rb index 0930565..4f38940 100644 --- a/test/unit/member_patch_test.rb +++ b/test/unit/member_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Member patch test class class MemberPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :members def setup @member1 = Member.find 1 diff --git a/test/unit/project_patch_test.rb b/test/unit/project_patch_test.rb index bd4e43f..269084c 100644 --- a/test/unit/project_patch_test.rb +++ b/test/unit/project_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Project patch test class class ProjectPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :projects def setup @project1 = Project.find 1 diff --git a/test/unit/time_entry_patch_test.rb b/test/unit/time_entry_patch_test.rb index b729966..b7663b8 100644 --- a/test/unit/time_entry_patch_test.rb +++ b/test/unit/time_entry_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Time entry patch test class class TimeEntryPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :time_entries def setup @time_entry1 = TimeEntry.find 1 diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index 8c041f3..7960d7f 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # User patch test class class UserPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :users def setup @user1 = User.find 1 diff --git a/test/unit/version_patch_test.rb b/test/unit/version_patch_test.rb index d0aab1a..77f1361 100644 --- a/test/unit/version_patch_test.rb +++ b/test/unit/version_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Version patch test class class VersionPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :versions def setup @version1 = Version.find 1 diff --git a/test/unit/wiki_content_patch_test.rb b/test/unit/wiki_content_patch_test.rb index 996efe7..ced182d 100644 --- a/test/unit/wiki_content_patch_test.rb +++ b/test/unit/wiki_content_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki content patch test class class WikiContentPatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :wiki_contents def setup @wiki_content1 = WikiContent.find 1 diff --git a/test/unit/wiki_page_patch_test.rb b/test/unit/wiki_page_patch_test.rb index 6da6094..f3f8c08 100644 --- a/test/unit/wiki_page_patch_test.rb +++ b/test/unit/wiki_page_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki page test class class WikiPagePatchTest < RedmineCustomWorkflows::Test::UnitTest - fixtures :wiki_pages def setup @wiki_page1 = WikiPage.find 1 diff --git a/test/unit_test.rb b/test/unit_test.rb index edf8dea..e443f89 100644 --- a/test/unit_test.rb +++ b/test/unit_test.rb @@ -21,15 +21,16 @@ module RedmineCustomWorkflows module Test # Unit test base class class UnitTest < ActiveSupport::TestCase - # Allow us to override the fixtures method to implement fixtures for our plugin. - # Ultimately it allows for better integration without blowing redmine fixtures up, - # and allowing us to suppliment redmine fixtures if we need to. - def self.fixtures(*table_names) - dir = File.join(File.dirname(__FILE__), '/fixtures') - table_names.each do |x| - ActiveRecord::FixtureSet.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml") + + def initialize(name) + super(name) + # Load all plugin's fixtures + dir = File.join(File.dirname(__FILE__), 'fixtures') + ext = '.yml' + Dir.glob("#{dir}/**/*#{ext}").each do |file| + fixture = File.basename(file, ext) + ActiveRecord::FixtureSet.create_fixtures dir, fixture end - super(table_names) end protected From 036c205b08ec0be7a52980dc9724afd7f4f852e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Mon, 29 Sep 2025 12:20:14 +0200 Subject: [PATCH 4/7] Rubocops --- .rubocop.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 9b33bef..b928840 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,7 +26,6 @@ AllCops: plugins: - rubocop-performance - - rubocop-rails # Rules for CustomWorkflows Metrics/BlockLength: From 7c80f63842054866f609140214f9747fbf3be839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Mon, 29 Sep 2025 14:05:23 +0200 Subject: [PATCH 5/7] Rubocop --- .rubocop.yml | 4 +--- app/models/custom_workflow.rb | 10 +++++----- .../patches/models/attachment_patch.rb | 10 +++++----- .../patches/models/group_patch.rb | 14 +++++++------- .../patches/models/issue_patch.rb | 14 +++++++------- .../patches/models/issue_relation_patch.rb | 10 +++++----- .../patches/models/member_patch.rb | 10 +++++----- .../patches/models/project_patch.rb | 14 +++++++------- .../patches/models/time_entry_patch.rb | 10 +++++----- .../patches/models/user_patch.rb | 10 +++++----- .../patches/models/version_patch.rb | 10 +++++----- .../patches/models/wiki_content_patch.rb | 10 +++++----- .../patches/models/wiki_page_patch.rb | 4 ++-- .../attachments_controller_patch_test.rb | 1 - .../functional/custom_workflows_controller_test.rb | 1 - .../issue_relations_controller_patch_test.rb | 1 - test/functional/issues_controller_patch_test.rb | 1 - test/functional/members_controller_patch_test.rb | 1 - test/functional/projects_controller_patch_test.rb | 1 - test/functional/timelog_controller_patch_test.rb | 1 - test/functional/users_controller_patch_test.rb | 1 - test/functional/versions_controller_patch_test.rb | 1 - test/functional/wiki_controller_patch_test.rb | 1 - test/test_case.rb | 3 +-- test/unit/attachment_patch_test.rb | 1 - test/unit/custom_workflow_test.rb | 1 - test/unit/group_patch_test.rb | 1 - test/unit/issue_patch_test.rb | 1 - test/unit/issue_relation_patch_test.rb | 1 - test/unit/member_patch_test.rb | 1 - test/unit/project_patch_test.rb | 1 - test/unit/time_entry_patch_test.rb | 1 - test/unit/user_patch_test.rb | 1 - test/unit/version_patch_test.rb | 1 - test/unit/wiki_content_patch_test.rb | 1 - test/unit/wiki_page_patch_test.rb | 1 - test/unit_test.rb | 3 +-- 37 files changed, 66 insertions(+), 92 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b928840..4c8f323 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,15 +18,13 @@ AllCops: TargetRubyVersion: 3.2 TargetRailsVersion: 7.1 + SuggestExtensions: false NewCops: enable Exclude: - '**/vendor/**/*' -plugins: - - rubocop-performance - # Rules for CustomWorkflows Metrics/BlockLength: Enabled: false diff --git a/app/models/custom_workflow.rb b/app/models/custom_workflow.rb index ee51045..dffa851 100644 --- a/app/models/custom_workflow.rb +++ b/app/models/custom_workflow.rb @@ -71,7 +71,7 @@ class CustomWorkflow < ApplicationRecord Rails.logger.info "#{str} for #{object.class} (##{object.id}) \"#{object}\"" end - def self.run_shared_code(object) + def self.run_shared_code?(object) # Due to DB migration if CustomWorkflow.table_exists? && CustomWorkflow.active.exists?(observable: :shared) log_message '= Running shared code', object @@ -86,7 +86,7 @@ class CustomWorkflow < ApplicationRecord true end - def self.run_custom_workflows(observable, object, event) + def self.run_custom_workflows?(observable, object, event) if CustomWorkflow.table_exists? # Due to DB migration workflows = CustomWorkflow.active.where(observable: observable) if PROJECT_OBSERVABLES.include? observable @@ -153,12 +153,12 @@ class CustomWorkflow < ApplicationRecord def validate_syntax case observable.to_sym when :shared - CustomWorkflow.run_shared_code self + CustomWorkflow.run_shared_code? self validate_syntax_for self, :shared_code when *SINGLE_OBSERVABLES object = observable.camelize.constantize.new object.send :instance_variable_set, "@#{observable}", object # compatibility with 0.0.1 - CustomWorkflow.run_shared_code object + CustomWorkflow.run_shared_code? object %i[before_save after_save before_destroy after_destroy].each { |field| validate_syntax_for object, field } when *COLLECTION_OBSERVABLES object = nil @@ -180,7 +180,7 @@ class CustomWorkflow < ApplicationRecord object.send :instance_variable_set, :@attachment, Attachment.new object.send :instance_variable_set, :@page, object end - CustomWorkflow.run_shared_code object + CustomWorkflow.run_shared_code? object %i[before_add after_add before_remove after_remove].each { |field| validate_syntax_for object, field } end end diff --git a/lib/redmine_custom_workflows/patches/models/attachment_patch.rb b/lib/redmine_custom_workflows/patches/models/attachment_patch.rb index 7636e78..a044ca0 100644 --- a/lib/redmine_custom_workflows/patches/models/attachment_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/attachment_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @attachment = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :attachment, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :attachment, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :attachment, self, :after_save + CustomWorkflow.run_custom_workflows? :attachment, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :attachment, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :attachment, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :attachment, self, :after_destroy + CustomWorkflow.run_custom_workflows? :attachment, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/group_patch.rb b/lib/redmine_custom_workflows/patches/models/group_patch.rb index 82b6826..f7f6b8f 100644 --- a/lib/redmine_custom_workflows/patches/models/group_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/group_patch.rb @@ -47,8 +47,8 @@ module RedmineCustomWorkflows def self.users_callback(event, group, user) group.instance_variable_set :@group, group group.instance_variable_set :@user, user - CustomWorkflow.run_shared_code(group) if event.to_s.starts_with? 'before_' - CustomWorkflow.run_custom_workflows :group_users, group, event + CustomWorkflow.run_shared_code?(group) if event.to_s.starts_with? 'before_' + CustomWorkflow.run_custom_workflows? :group_users, group, event end %i[before_add before_remove after_add after_remove].each do |observable| @@ -62,8 +62,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @group = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :group, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :group, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -72,16 +72,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :group, self, :after_save + CustomWorkflow.run_custom_workflows? :group, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :group, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :group, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :group, self, :after_destroy + CustomWorkflow.run_custom_workflows? :group, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/issue_patch.rb b/lib/redmine_custom_workflows/patches/models/issue_patch.rb index 5bd61bb..a1cda34 100644 --- a/lib/redmine_custom_workflows/patches/models/issue_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/issue_patch.rb @@ -46,8 +46,8 @@ module RedmineCustomWorkflows def self.attachments_callback(event, issue, attachment) issue.instance_variable_set :@issue, issue issue.instance_variable_set :@attachment, attachment - CustomWorkflow.run_shared_code(issue) if event.to_s.starts_with? 'before_' - CustomWorkflow.run_custom_workflows :issue_attachments, issue, event + CustomWorkflow.run_shared_code?(issue) if event.to_s.starts_with? 'before_' + CustomWorkflow.run_custom_workflows? :issue_attachments, issue, event end %i[before_add before_remove after_add after_remove].each do |observable| @@ -76,8 +76,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @issue = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :issue, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :issue, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -86,16 +86,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :issue, self, :after_save + CustomWorkflow.run_custom_workflows? :issue, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows(:issue, self, :before_destroy) + res = CustomWorkflow.run_custom_workflows?(:issue, self, :before_destroy) throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :issue, self, :after_destroy + CustomWorkflow.run_custom_workflows? :issue, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb b/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb index b73739f..2d53433 100644 --- a/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/issue_relation_patch.rb @@ -60,8 +60,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @issue_relation = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :issue_relation, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :issue_relation, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) ensure @@ -69,16 +69,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :issue_relation, self, :after_save + CustomWorkflow.run_custom_workflows? :issue_relation, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :issue_relation, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :issue_relation, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :issue_relation, self, :after_destroy + CustomWorkflow.run_custom_workflows? :issue_relation, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/member_patch.rb b/lib/redmine_custom_workflows/patches/models/member_patch.rb index 598affd..a05e7d7 100644 --- a/lib/redmine_custom_workflows/patches/models/member_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/member_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @member = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :member, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :member, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :member, self, :after_save + CustomWorkflow.run_custom_workflows? :member, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :member, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :member, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :member, self, :after_destroy + CustomWorkflow.run_custom_workflows? :member, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/project_patch.rb b/lib/redmine_custom_workflows/patches/models/project_patch.rb index 12ae4b1..9e82697 100644 --- a/lib/redmine_custom_workflows/patches/models/project_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/project_patch.rb @@ -55,8 +55,8 @@ module RedmineCustomWorkflows def self.attachments_callback(event, project, attachment) project.instance_variable_set(:@project, project) project.instance_variable_set(:@attachment, attachment) - CustomWorkflow.run_shared_code(project) if event.to_s.starts_with? 'before_' - CustomWorkflow.run_custom_workflows(:project_attachments, project, event) + CustomWorkflow.run_shared_code?(project) if event.to_s.starts_with? 'before_' + CustomWorkflow.run_custom_workflows?(:project_attachments, project, event) end %i[before_add before_remove after_add after_remove].each do |observable| @@ -70,8 +70,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @project = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :project, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :project, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -80,16 +80,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :project, self, :after_save + CustomWorkflow.run_custom_workflows? :project, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :project, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :project, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :project, self, :after_destroy + CustomWorkflow.run_custom_workflows? :project, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb b/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb index 22f150d..ae3b5cb 100644 --- a/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/time_entry_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @time_entry = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code(self) - CustomWorkflow.run_custom_workflows(:time_entry, self, :before_save) + CustomWorkflow.run_shared_code?(self) + CustomWorkflow.run_custom_workflows?(:time_entry, self, :before_save) throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :time_entry, self, :after_save + CustomWorkflow.run_custom_workflows? :time_entry, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :time_entry, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :time_entry, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :time_entry, self, :after_destroy + CustomWorkflow.run_custom_workflows? :time_entry, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/user_patch.rb b/lib/redmine_custom_workflows/patches/models/user_patch.rb index 475273b..633d12f 100644 --- a/lib/redmine_custom_workflows/patches/models/user_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/user_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @user = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :user, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :user, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :user, self, :after_save + CustomWorkflow.run_custom_workflows? :user, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :user, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :user, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :user, self, :after_destroy + CustomWorkflow.run_custom_workflows? :user, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/version_patch.rb b/lib/redmine_custom_workflows/patches/models/version_patch.rb index bfe091f..cabdffd 100644 --- a/lib/redmine_custom_workflows/patches/models/version_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/version_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @version = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :version, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :version, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :version, self, :after_save + CustomWorkflow.run_custom_workflows? :version, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :version, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :version, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :version, self, :after_destroy + CustomWorkflow.run_custom_workflows? :version, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb b/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb index c4bc3d6..af33574 100644 --- a/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/wiki_content_patch.rb @@ -42,8 +42,8 @@ module RedmineCustomWorkflows def before_save_custom_workflows @content = self @saved_attributes = attributes.dup - CustomWorkflow.run_shared_code self - CustomWorkflow.run_custom_workflows :wiki_content, self, :before_save + CustomWorkflow.run_shared_code? self + CustomWorkflow.run_custom_workflows? :wiki_content, self, :before_save throw :abort if errors.any? errors.empty? && (@saved_attributes == attributes || valid?) @@ -52,16 +52,16 @@ module RedmineCustomWorkflows end def after_save_custom_workflows - CustomWorkflow.run_custom_workflows :wiki_content, self, :after_save + CustomWorkflow.run_custom_workflows? :wiki_content, self, :after_save end def before_destroy_custom_workflows - res = CustomWorkflow.run_custom_workflows :wiki_content, self, :before_destroy + res = CustomWorkflow.run_custom_workflows? :wiki_content, self, :before_destroy throw :abort if res == false end def after_destroy_custom_workflows - CustomWorkflow.run_custom_workflows :wiki_content, self, :after_destroy + CustomWorkflow.run_custom_workflows? :wiki_content, self, :after_destroy end end end diff --git a/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb b/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb index 8d7921c..4235460 100644 --- a/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb +++ b/lib/redmine_custom_workflows/patches/models/wiki_page_patch.rb @@ -41,8 +41,8 @@ module RedmineCustomWorkflows def self.attachments_callback(event, page, attachment) page.instance_variable_set :@page, page page.instance_variable_set :@attachment, attachment - CustomWorkflow.run_shared_code(page) if event.to_s.starts_with? 'before_' - CustomWorkflow.run_custom_workflows :wiki_page_attachments, page, event + CustomWorkflow.run_shared_code?(page) if event.to_s.starts_with? 'before_' + CustomWorkflow.run_custom_workflows? :wiki_page_attachments, page, event end %i[before_add before_remove after_add after_remove].each do |observable| diff --git a/test/functional/attachments_controller_patch_test.rb b/test/functional/attachments_controller_patch_test.rb index 8da9256..08fa41f 100644 --- a/test/functional/attachments_controller_patch_test.rb +++ b/test/functional/attachments_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Attachment controller patch test class AttachmentsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @attachment8 = Attachment.find 8 diff --git a/test/functional/custom_workflows_controller_test.rb b/test/functional/custom_workflows_controller_test.rb index 29e32f8..0204024 100644 --- a/test/functional/custom_workflows_controller_test.rb +++ b/test/functional/custom_workflows_controller_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Custom workflows controller test class CustomWorkflowsControllerTest < RedmineCustomWorkflows::Test::TestCase - def setup super @cw1 = CustomWorkflow.find 1 diff --git a/test/functional/issue_relations_controller_patch_test.rb b/test/functional/issue_relations_controller_patch_test.rb index 78c0149..ac04133 100644 --- a/test/functional/issue_relations_controller_patch_test.rb +++ b/test/functional/issue_relations_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue relation controller patch test class IssueRelationsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @ir1 = IssueRelation.find 1 diff --git a/test/functional/issues_controller_patch_test.rb b/test/functional/issues_controller_patch_test.rb index 1f6e5c7..3b9a3ee 100644 --- a/test/functional/issues_controller_patch_test.rb +++ b/test/functional/issues_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue controller patch test class IssuesControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @issue1 = Issue.find 1 diff --git a/test/functional/members_controller_patch_test.rb b/test/functional/members_controller_patch_test.rb index 6bfc94b..fafac76 100644 --- a/test/functional/members_controller_patch_test.rb +++ b/test/functional/members_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Users controller patch test class MembersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @member1 = Member.find 1 diff --git a/test/functional/projects_controller_patch_test.rb b/test/functional/projects_controller_patch_test.rb index adc5733..fb29a8f 100644 --- a/test/functional/projects_controller_patch_test.rb +++ b/test/functional/projects_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Project controller patch test class ProjectsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super post '/login', params: { username: 'jsmith', password: 'jsmith' } diff --git a/test/functional/timelog_controller_patch_test.rb b/test/functional/timelog_controller_patch_test.rb index 8e6df31..aeac602 100644 --- a/test/functional/timelog_controller_patch_test.rb +++ b/test/functional/timelog_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Time controller patch test class TimelogControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @te1 = TimeEntry.find 1 diff --git a/test/functional/users_controller_patch_test.rb b/test/functional/users_controller_patch_test.rb index 1d8d4a1..de352be 100644 --- a/test/functional/users_controller_patch_test.rb +++ b/test/functional/users_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Users controller patch test class UsersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super post '/login', params: { username: 'admin', password: 'admin' } diff --git a/test/functional/versions_controller_patch_test.rb b/test/functional/versions_controller_patch_test.rb index 43fbbf3..8d87124 100644 --- a/test/functional/versions_controller_patch_test.rb +++ b/test/functional/versions_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Version controller patch test class VersionsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @version1 = Version.find 1 diff --git a/test/functional/wiki_controller_patch_test.rb b/test/functional/wiki_controller_patch_test.rb index 2288c95..3a4121c 100644 --- a/test/functional/wiki_controller_patch_test.rb +++ b/test/functional/wiki_controller_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki controller patch test class WikiControllerPatchTest < RedmineCustomWorkflows::Test::TestCase - def setup super @wp1 = WikiPage.find 1 diff --git a/test/test_case.rb b/test/test_case.rb index 69eeb9b..631380d 100644 --- a/test/test_case.rb +++ b/test/test_case.rb @@ -21,9 +21,8 @@ module RedmineCustomWorkflows module Test # Test case base class class TestCase < ActionDispatch::IntegrationTest - def initialize(name) - super(name) + super # Load all plugin's fixtures dir = File.join(File.dirname(__FILE__), 'fixtures') ext = '.yml' diff --git a/test/unit/attachment_patch_test.rb b/test/unit/attachment_patch_test.rb index a1f694b..ccceb13 100644 --- a/test/unit/attachment_patch_test.rb +++ b/test/unit/attachment_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Attachment patch test class class AttachmentPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @attachment1 = Attachment.find 1 end diff --git a/test/unit/custom_workflow_test.rb b/test/unit/custom_workflow_test.rb index f8f0250..fa2572e 100644 --- a/test/unit/custom_workflow_test.rb +++ b/test/unit/custom_workflow_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Custom workflow test class class CustomWorkflowTest < RedmineCustomWorkflows::Test::UnitTest - def setup @cw1 = CustomWorkflow.find 1 end diff --git a/test/unit/group_patch_test.rb b/test/unit/group_patch_test.rb index 9b29cf6..0409bf4 100644 --- a/test/unit/group_patch_test.rb +++ b/test/unit/group_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Group patch test class class GroupPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @group10 = Group.find 10 end diff --git a/test/unit/issue_patch_test.rb b/test/unit/issue_patch_test.rb index d1ca580..3b7af2c 100644 --- a/test/unit/issue_patch_test.rb +++ b/test/unit/issue_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue patch test class class IssuePatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @issue1 = Issue.find 1 end diff --git a/test/unit/issue_relation_patch_test.rb b/test/unit/issue_relation_patch_test.rb index 8193ecf..bc8d4fc 100644 --- a/test/unit/issue_relation_patch_test.rb +++ b/test/unit/issue_relation_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Issue relation patch test class class IssueRelationPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @issue_relation1 = IssueRelation.find 1 end diff --git a/test/unit/member_patch_test.rb b/test/unit/member_patch_test.rb index 4f38940..52eca21 100644 --- a/test/unit/member_patch_test.rb +++ b/test/unit/member_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Member patch test class class MemberPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @member1 = Member.find 1 end diff --git a/test/unit/project_patch_test.rb b/test/unit/project_patch_test.rb index 269084c..897320f 100644 --- a/test/unit/project_patch_test.rb +++ b/test/unit/project_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Project patch test class class ProjectPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @project1 = Project.find 1 end diff --git a/test/unit/time_entry_patch_test.rb b/test/unit/time_entry_patch_test.rb index b7663b8..d7ecfcf 100644 --- a/test/unit/time_entry_patch_test.rb +++ b/test/unit/time_entry_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Time entry patch test class class TimeEntryPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @time_entry1 = TimeEntry.find 1 end diff --git a/test/unit/user_patch_test.rb b/test/unit/user_patch_test.rb index 7960d7f..eb46548 100644 --- a/test/unit/user_patch_test.rb +++ b/test/unit/user_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # User patch test class class UserPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @user1 = User.find 1 end diff --git a/test/unit/version_patch_test.rb b/test/unit/version_patch_test.rb index 77f1361..ec1edb4 100644 --- a/test/unit/version_patch_test.rb +++ b/test/unit/version_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Version patch test class class VersionPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @version1 = Version.find 1 end diff --git a/test/unit/wiki_content_patch_test.rb b/test/unit/wiki_content_patch_test.rb index ced182d..b166609 100644 --- a/test/unit/wiki_content_patch_test.rb +++ b/test/unit/wiki_content_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki content patch test class class WikiContentPatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @wiki_content1 = WikiContent.find 1 end diff --git a/test/unit/wiki_page_patch_test.rb b/test/unit/wiki_page_patch_test.rb index f3f8c08..268ac80 100644 --- a/test/unit/wiki_page_patch_test.rb +++ b/test/unit/wiki_page_patch_test.rb @@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__) # Wiki page test class class WikiPagePatchTest < RedmineCustomWorkflows::Test::UnitTest - def setup @wiki_page1 = WikiPage.find 1 end diff --git a/test/unit_test.rb b/test/unit_test.rb index e443f89..86b3d69 100644 --- a/test/unit_test.rb +++ b/test/unit_test.rb @@ -21,9 +21,8 @@ module RedmineCustomWorkflows module Test # Unit test base class class UnitTest < ActiveSupport::TestCase - def initialize(name) - super(name) + super # Load all plugin's fixtures dir = File.join(File.dirname(__FILE__), 'fixtures') ext = '.yml' From 95da97fb77e6a8f9494e19993f8f814f602cbaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 1 Oct 2025 10:00:38 +0200 Subject: [PATCH 6/7] Redmine 6.1 --- .github/workflows/rubyonrails.yml | 2 +- .rubocop.yml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index af05097..cfbcdb5 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -82,7 +82,7 @@ jobs: sudo apt-get install subversion - name: Clone Redmine # Get the latest stable Redmine - run: svn export http://svn.redmine.org/redmine/branches/6.0-stable/ /opt/redmine + run: svn export http://svn.redmine.org/redmine/branches/6.1-stable/ /opt/redmine - name: Checkout code uses: actions/checkout@v3 - name: Link the plugin diff --git a/.rubocop.yml b/.rubocop.yml index 4c8f323..8c97abe 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,16 +15,19 @@ # You should have received a copy of the GNU General Public License along with Redmine Custom Workflows plugin. If not, # see . +plugins: + rubocop-rails + AllCops: TargetRubyVersion: 3.2 TargetRailsVersion: 7.1 SuggestExtensions: false - NewCops: enable - Exclude: - '**/vendor/**/*' + NewCops: enable + # Rules for CustomWorkflows Metrics/BlockLength: Enabled: false From 1e4e6c4af3521c6f54e1da9be26cdcb28e11376b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Fri, 3 Oct 2025 09:45:03 +0200 Subject: [PATCH 7/7] v3.0.2 released --- .github/workflows/rubyonrails.yml | 4 ++-- CHANGELOG.md | 7 ++++++- README.md | 4 ++-- init.rb | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index cfbcdb5..dd8a867 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -20,9 +20,9 @@ name: "GitHub CI" on: push: - branches: ["devel"] + branches: ["master"] pull_request: - branches: ["devel"] + branches: ["master"] jobs: plugin_tests: strategy: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b96ae3..c9cf85f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog for Custom Workflows -3.0.2 *????-??-??* +3.0.2 *2025-10-03* ------------------ + Chinese localisation + Redmine 6.1 compatibility + +* New: #362 - Chinese (Simplified) locale + 3.0.1 *2025-07-07* ------------------ SQL Server compatibility diff --git a/README.md b/README.md index e028162..19f2fa8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Custom Workflows plug-in 3.0.2 devel +# Custom Workflows plug-in 3.0.2 -[![GitHub CI](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml/badge.svg?branch=devel)](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml) +[![GitHub CI](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml/badge.svg?branch=master)](https://github.com/anteo/redmine_custom_workflows/actions/workflows/rubyonrails.yml) [![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine) This plug-in provides a great functionality for those who is familiar with the Ruby language. diff --git a/init.rb b/init.rb index f1c4621..9375bec 100644 --- a/init.rb +++ b/init.rb @@ -26,7 +26,7 @@ Redmine::Plugin.register :redmine_custom_workflows do author_url 'https://github.com/anteo/redmine_custom_workflows/graphs/contributors' author 'Anton Argirov/Karel Pičman' description 'It allows to create custom workflows for objects, defined in a plain Ruby language' - version '3.0.2 devel' + version '3.0.2' requires_redmine version_or_higher: '6.0.0'