Skip to content

Commit

Permalink
Fixture cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Dec 10, 2024
1 parent 485e125 commit 2f6266b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 38 deletions.
11 changes: 0 additions & 11 deletions test/functional/issue_view_columns_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 0 additions & 13 deletions test/functional/issues_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 12 additions & 6 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
8 changes: 0 additions & 8 deletions test/unit/project_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f6266b

Please sign in to comment.