From 2f6266b6d8c4055bc6fa1b6bdfa104edc8241fa7 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Tue, 10 Dec 2024 21:33:52 +0100 Subject: [PATCH] Fixture cleanups --- .../issue_view_columns_controller_test.rb | 11 ----------- test/functional/issues_controller_test.rb | 13 ------------- test/test_helper.rb | 18 ++++++++++++------ test/unit/project_test.rb | 8 -------- 4 files changed, 12 insertions(+), 38 deletions(-) diff --git a/test/functional/issue_view_columns_controller_test.rb b/test/functional/issue_view_columns_controller_test.rb index 1984fa1..6021a23 100644 --- a/test/functional/issue_view_columns_controller_test.rb +++ b/test/functional/issue_view_columns_controller_test.rb @@ -3,17 +3,6 @@ require File.expand_path '../../test_helper', __FILE__ class IssueViewColumnsControllerTest < RedmineIssueViewColumns::ControllerTest - fixtures :users, :email_addresses, :roles, - :enumerations, - :projects, :projects_trackers, :enabled_modules, - :members, :member_roles, - :issues, :issue_statuses, :issue_categories, :issue_relations, - :versions, - :trackers, - :workflows, - :custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers, - :time_entries, :issue_view_columns - include Redmine::I18n include CrudControllerBase diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index aa9a286..6b3e785 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -3,19 +3,6 @@ require File.expand_path '../../test_helper', __FILE__ class IssuesControllerTest < RedmineIssueViewColumns::ControllerTest - fixtures :users, :email_addresses, :roles, - :enumerations, - :projects, :projects_trackers, :enabled_modules, - :members, :member_roles, - :issues, :issue_statuses, :issue_categories, :issue_relations, - :versions, - :trackers, - :workflows, - :custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers, - :time_entries, - :watchers, :journals, :journal_details, - :queries, :issue_view_columns - def setup prepare_tests diff --git a/test/test_helper.rb b/test/test_helper.rb index bff2083..ddeb9ce 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -14,6 +14,7 @@ end require File.expand_path "#{File.dirname __FILE__}/../../../test/test_helper" +require File.expand_path "#{File.dirname __FILE__}/../../additionals/test/global_fixtures_helper" require File.expand_path "#{File.dirname __FILE__}/../../additionals/test/global_test_helper" require File.expand_path "#{File.dirname __FILE__}/../../additionals/test/crud_controller_base" @@ -34,27 +35,32 @@ def prepare_tests end module PluginFixturesLoader - def fixtures(*table_names) - dir = "#{File.dirname __FILE__}/fixtures/" - table_names.each do |x| - ActiveRecord::FixtureSet.create_fixtures dir, x if File.exist? "#{dir}/#{x}.yml" - end - super table_names + include Additionals::GlobalFixturesHelper + + def plugin_fixture_path + "#{File.dirname __FILE__}/fixtures" + end + + def plugin_fixtures_list + %i[issue_view_columns] end end class ControllerTest < Redmine::ControllerTest include RedmineIssueViewColumns::TestHelper extend PluginFixturesLoader + fixtures(*fixtures_list) end class TestCase < ActiveSupport::TestCase include RedmineIssueViewColumns::TestHelper extend PluginFixturesLoader + fixtures(*fixtures_list) end class IntegrationTest < Redmine::IntegrationTest include RedmineIssueViewColumns::TestHelper extend PluginFixturesLoader + fixtures(*fixtures_list) end end diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index ddd4a34..42c12a5 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -3,14 +3,6 @@ require File.expand_path '../../test_helper', __FILE__ class ProjectTest < RedmineIssueViewColumns::TestCase - fixtures :projects, :trackers, :issue_statuses, :issues, - :journals, :journal_details, - :enumerations, :users, :issue_categories, - :projects_trackers, - :roles, :member_roles, :members, - :enabled_modules, :groups_users, - :workflows, :issue_view_columns - def setup prepare_tests User.current = nil