diff --git a/.github/workflows/5_1_2.yml b/.github/workflows/5_1_4.yml similarity index 98% rename from .github/workflows/5_1_2.yml rename to .github/workflows/5_1_4.yml index 5c511f6..88e49de 100644 --- a/.github/workflows/5_1_2.yml +++ b/.github/workflows/5_1_4.yml @@ -1,8 +1,8 @@ -name: Tests 5.1.2 +name: Tests 5.1.4 env: PLUGIN_NAME: redmine_admin_activity - REDMINE_VERSION: 5.1.2 + REDMINE_VERSION: 5.1.4 RAILS_ENV: test on: @@ -16,7 +16,7 @@ jobs: strategy: matrix: - ruby: ['3.1'] + ruby: ['3.2'] db: ['postgres'] fail-fast: false diff --git a/.github/workflows/4_2_11.yml b/.github/workflows/6_0_1.yml similarity index 98% rename from .github/workflows/4_2_11.yml rename to .github/workflows/6_0_1.yml index 81c60dc..ab4a278 100644 --- a/.github/workflows/4_2_11.yml +++ b/.github/workflows/6_0_1.yml @@ -1,8 +1,8 @@ -name: Tests 4.2.11 +name: Tests 6.0.1 env: PLUGIN_NAME: redmine_admin_activity - REDMINE_VERSION: 4.2.11 + REDMINE_VERSION: 6.0.1 RAILS_ENV: test on: @@ -16,7 +16,7 @@ jobs: strategy: matrix: - ruby: ['2.7'] + ruby: ['3.3'] db: ['postgres'] fail-fast: false diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 5b20031..5eb7bfe 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - ruby: ['3.2'] + ruby: ['3.3'] db: ['postgres'] fail-fast: false diff --git a/README.md b/README.md index bac4303..2d49dd7 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ To run tests, install the redmine_base_rspec plugin (https://github.com/jbbarth/ |Plugin branch| Redmine Version | Test Status | |-------------|-----------------|-------------------| -|master | 5.1.2 | [![5.1.2][1]][5] | -|master | 4.2.11 | [![4.2.11][2]][5] | +|master | 5.1.4 | [![5.1.4][1]][5] | +|master | 6.0.1 | [![6.0.1][2]][5] | |master | master | [![master][4]][5] | -[1]: https://github.com/nanego/redmine_admin_activity/actions/workflows/5_1_2.yml/badge.svg -[2]: https://github.com/nanego/redmine_admin_activity/actions/workflows/4_2_11.yml/badge.svg +[1]: https://github.com/nanego/redmine_admin_activity/actions/workflows/5_1_4.yml/badge.svg +[2]: https://github.com/nanego/redmine_admin_activity/actions/workflows/6_0_1.yml/badge.svg [4]: https://github.com/nanego/redmine_admin_activity/actions/workflows/master.yml/badge.svg [5]: https://github.com/nanego/redmine_admin_activity/actions diff --git a/app/models/journal_setting.rb b/app/models/journal_setting.rb index cb9314e..1fb7a9c 100644 --- a/app/models/journal_setting.rb +++ b/app/models/journal_setting.rb @@ -1,4 +1,5 @@ -class JournalSetting < ActiveRecord::Base +class JournalSetting < ApplicationRecord + belongs_to :user, :optional => false belongs_to :journalized, :polymorphic => true, :optional => true diff --git a/init.rb b/init.rb index a0daf1d..24e315b 100644 --- a/init.rb +++ b/init.rb @@ -11,3 +11,10 @@ # requires_redmine_plugin :redmine_base_rspec, :version_or_higher => '0.0.4' if Rails.env.test? # requires_redmine_plugin :redmine_base_deface, :version_or_higher => '0.0.1' end + +# Support for Redmine 5 +if Redmine::VERSION::MAJOR < 6 + class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true + end +end diff --git a/lib/redmine_admin_activity/models/custom_field_patch.rb b/lib/redmine_admin_activity/models/custom_field_patch.rb index 001af30..357d732 100644 --- a/lib/redmine_admin_activity/models/custom_field_patch.rb +++ b/lib/redmine_admin_activity/models/custom_field_patch.rb @@ -12,7 +12,7 @@ def to_s end end -class CustomField < ActiveRecord::Base +class CustomField < ApplicationRecord prepend RedmineAdminActivity::Models::CustomFieldPatch def self.representative_columns diff --git a/lib/redmine_admin_activity/models/issue_template_patch.rb b/lib/redmine_admin_activity/models/issue_template_patch.rb index 9d67383..9a18818 100644 --- a/lib/redmine_admin_activity/models/issue_template_patch.rb +++ b/lib/redmine_admin_activity/models/issue_template_patch.rb @@ -28,7 +28,7 @@ def journalized_deactivation_template(project) end end -class IssueTemplate < ActiveRecord::Base +class IssueTemplate < ApplicationRecord prepend RedmineAdminActivity::Models::IssueTemplatePatch has_many :template_projects, through: :issue_template_projects, source: :project, before_remove: :journalized_deactivation_template, after_add: :journalized_activation_template diff --git a/lib/redmine_admin_activity/models/member_patch.rb b/lib/redmine_admin_activity/models/member_patch.rb index 4c2a376..f3b7005 100644 --- a/lib/redmine_admin_activity/models/member_patch.rb +++ b/lib/redmine_admin_activity/models/member_patch.rb @@ -19,7 +19,7 @@ def update_project_journal end end -class Member < ActiveRecord::Base +class Member < ApplicationRecord prepend RedmineAdminActivity::Models::MemberPatch attr_reader :project_journal diff --git a/lib/redmine_admin_activity/models/organization_patch.rb b/lib/redmine_admin_activity/models/organization_patch.rb index 627d9df..59d4087 100644 --- a/lib/redmine_admin_activity/models/organization_patch.rb +++ b/lib/redmine_admin_activity/models/organization_patch.rb @@ -19,7 +19,7 @@ def journalize_creation(user) end end -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord prepend RedmineAdminActivity::Models::OrganizationPatch def self.representative_columns diff --git a/lib/redmine_admin_activity/models/project_patch.rb b/lib/redmine_admin_activity/models/project_patch.rb index b664faf..46d0d7d 100644 --- a/lib/redmine_admin_activity/models/project_patch.rb +++ b/lib/redmine_admin_activity/models/project_patch.rb @@ -37,7 +37,7 @@ def create_journal end end -class Project < ActiveRecord::Base +class Project < ApplicationRecord prepend RedmineAdminActivity::Models::ProjectPatch acts_as_watchable diff --git a/lib/redmine_admin_activity/models/version_patch.rb b/lib/redmine_admin_activity/models/version_patch.rb index 567bdbb..4dfd181 100644 --- a/lib/redmine_admin_activity/models/version_patch.rb +++ b/lib/redmine_admin_activity/models/version_patch.rb @@ -22,7 +22,7 @@ def save_previous_version end end -class Version < ActiveRecord::Base +class Version < ApplicationRecord prepend RedmineAdminActivity::Models::VersionPatch before_update :save_previous_version diff --git a/spec/controllers/custom_field_enumerations_controller_spec.rb b/spec/controllers/custom_field_enumerations_controller_spec.rb index 8f36ebf..f488f76 100644 --- a/spec/controllers/custom_field_enumerations_controller_spec.rb +++ b/spec/controllers/custom_field_enumerations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe CustomFieldEnumerationsController, type: :controller do render_views @@ -12,7 +12,8 @@ @controller = CustomFieldEnumerationsController.new @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new - User.current = nil + User.current = User.find(1) + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard ProjectCustomField.create(:name => 'field test', field_format: "enumeration") end diff --git a/spec/controllers/custom_fields_controller_spec.rb b/spec/controllers/custom_fields_controller_spec.rb index d760d34..8ff1405 100644 --- a/spec/controllers/custom_fields_controller_spec.rb +++ b/spec/controllers/custom_fields_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe CustomFieldsController, type: :controller do render_views @@ -15,6 +15,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/controllers/issue_categories_controller_spec.rb b/spec/controllers/issue_categories_controller_spec.rb index cfb9436..d9673f1 100644 --- a/spec/controllers/issue_categories_controller_spec.rb +++ b/spec/controllers/issue_categories_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe IssueCategoriesController, type: :controller do render_views @@ -12,6 +12,7 @@ before do User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 2 #permissions are hard end diff --git a/spec/controllers/issue_templates_controller_spec.rb b/spec/controllers/issue_templates_controller_spec.rb index fa551d8..0481993 100644 --- a/spec/controllers/issue_templates_controller_spec.rb +++ b/spec/controllers/issue_templates_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' if Redmine::Plugin.installed?(:redmine_templates) describe IssueTemplatesController, type: :controller do @@ -9,6 +9,7 @@ before do User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 end diff --git a/spec/controllers/members_controller_patch_spec.rb b/spec/controllers/members_controller_patch_spec.rb index 5e8b5a9..aa5eb38 100644 --- a/spec/controllers/members_controller_patch_spec.rb +++ b/spec/controllers/members_controller_patch_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe MembersController, type: :controller do render_views @@ -15,6 +15,7 @@ include Redmine::I18n before do + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard if Redmine::Plugin.installed?(:redmine_limited_visibility) member.function_ids = [Function.first.id] diff --git a/spec/controllers/organizations/memberships_controller_spec.rb b/spec/controllers/organizations/memberships_controller_spec.rb index 47f5990..cbbb092 100644 --- a/spec/controllers/organizations/memberships_controller_spec.rb +++ b/spec/controllers/organizations/memberships_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' if Redmine::Plugin.installed?(:redmine_organizations) describe Organizations::MembershipsController, type: :controller do @@ -23,6 +23,7 @@ before do User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 # permissions are hard user.update_attribute(:organization, organization) new_user.update_attribute(:organization, organization) diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb index 26d62e8..8d307f9 100644 --- a/spec/controllers/organizations_controller_spec.rb +++ b/spec/controllers/organizations_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' if Redmine::Plugin.installed?(:redmine_organizations) describe OrganizationsController, type: :controller do @@ -13,6 +13,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 end diff --git a/spec/controllers/principal_memberships_controller_patch_spec.rb b/spec/controllers/principal_memberships_controller_patch_spec.rb index 96a8ad3..37549ec 100644 --- a/spec/controllers/principal_memberships_controller_patch_spec.rb +++ b/spec/controllers/principal_memberships_controller_patch_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe PrincipalMembershipsController, type: :controller do render_views @@ -15,6 +15,7 @@ include Redmine::I18n before do + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index c19e4c4..a9d7075 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe ProjectsController, type: :controller do @@ -17,6 +17,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 2 # permissions are hard end diff --git a/spec/controllers/settings_controller_spec.rb b/spec/controllers/settings_controller_spec.rb index 79bf539..e015434 100644 --- a/spec/controllers/settings_controller_spec.rb +++ b/spec/controllers/settings_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe SettingsController, type: :controller do @@ -11,6 +11,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/controllers/trackers_controller_spec.rb b/spec/controllers/trackers_controller_spec.rb index cae92aa..52a4811 100644 --- a/spec/controllers/trackers_controller_spec.rb +++ b/spec/controllers/trackers_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe TrackersController, type: :controller do render_views @@ -15,6 +15,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 37559be..aa60464 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe UsersController, type: :controller do @@ -13,6 +13,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 # permissions admin end diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rb index fc11a3b..a04367c 100644 --- a/spec/controllers/versions_controller_spec.rb +++ b/spec/controllers/versions_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe VersionsController, type: :controller do render_views @@ -15,6 +15,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rb index a17c90f..2fff499 100644 --- a/spec/controllers/wiki_controller_spec.rb +++ b/spec/controllers/wiki_controller_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require 'rails_helper' describe WikiController, type: :controller do @@ -12,7 +12,7 @@ @controller = WikiController.new @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new - User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 #permissions are hard end diff --git a/spec/helpers/issues_helper_patch_spec.rb b/spec/helpers/issues_helper_patch_spec.rb index 40c8968..e8dfbf5 100644 --- a/spec/helpers/issues_helper_patch_spec.rb +++ b/spec/helpers/issues_helper_patch_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" describe "IssuesHelperPatch" do include ApplicationHelper diff --git a/spec/helpers/journal_settings_helper_spec.rb b/spec/helpers/journal_settings_helper_spec.rb index d154225..4204f0e 100644 --- a/spec/helpers/journal_settings_helper_spec.rb +++ b/spec/helpers/journal_settings_helper_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" describe "JournalSettingsHelper" do include ApplicationHelper diff --git a/spec/helpers/projects_helper_patch_spec.rb b/spec/helpers/projects_helper_patch_spec.rb index d41ea42..e530707 100644 --- a/spec/helpers/projects_helper_patch_spec.rb +++ b/spec/helpers/projects_helper_patch_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" describe ProjectsHelper, :type => :controller do @@ -12,6 +12,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 3 end diff --git a/spec/helpers/settings_helper_patch_spec.rb b/spec/helpers/settings_helper_patch_spec.rb index 379d1d5..dddd3b3 100644 --- a/spec/helpers/settings_helper_patch_spec.rb +++ b/spec/helpers/settings_helper_patch_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" describe SettingsHelper, :type => :controller do @@ -9,6 +9,7 @@ @request = ActionDispatch::TestRequest.create @response = ActionDispatch::TestResponse.new User.current = nil + @request.session = ActionController::TestSession.new @request.session[:user_id] = 1 end diff --git a/spec/models/journal_setting_spec.rb b/spec/models/journal_setting_spec.rb index bf08a85..0f3e61a 100644 --- a/spec/models/journal_setting_spec.rb +++ b/spec/models/journal_setting_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" RSpec.describe JournalSetting, type: :model do diff --git a/spec/system/activities_system_spec.rb b/spec/system/activities_system_spec.rb index e63fc31..a61bc07 100644 --- a/spec/system/activities_system_spec.rb +++ b/spec/system/activities_system_spec.rb @@ -1,4 +1,4 @@ -require "spec_helper" +require "rails_helper" RSpec.describe "activities", type: :system do fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,