Skip to content

Commit

Permalink
Use same fixtures for all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Dec 10, 2024
1 parent 1d2e3fb commit 38883dd
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 240 deletions.
18 changes: 0 additions & 18 deletions test/functional/additional_tags_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class AdditionalTagsControllerTest < AdditionalTags::ControllerTest
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:additional_tags, :additional_taggings

def setup
prepare_tests
# run as the admin
Expand Down
19 changes: 0 additions & 19 deletions test/functional/auto_completes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class AutoCompletesControllerTest < AdditionalTags::ControllerTest
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:wikis, :wiki_pages, :wiki_contents, :wiki_content_versions,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:additional_tags, :additional_taggings

def setup
prepare_tests
@tag = ActsAsTaggableOn::Tag.find_by name: 'First'
Expand Down
17 changes: 0 additions & 17 deletions test/functional/dashboard_async_blocks_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class DashboardAsyncBlocksControllerTest < AdditionalTags::ControllerTest
fixtures :projects, :users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:issues,
:issue_relations,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:journals, :journal_details,
:repositories, :changesets,
:queries, :watchers,
:additional_tags, :additional_taggings, :dashboards

include Redmine::I18n

def setup
Expand Down
18 changes: 0 additions & 18 deletions test/functional/issue_tags_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class IssueTagsControllerTest < AdditionalTags::ControllerTest
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:additional_tags, :additional_taggings

def setup
prepare_tests
@request.env['HTTP_REFERER'] = '/issue_tags'
Expand Down
21 changes: 0 additions & 21 deletions test/functional/issues_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class IssuesControllerTest < AdditionalTags::ControllerTest
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:time_entries,
:journals, :journal_details,
:queries,
:additional_tags, :additional_taggings

include Redmine::I18n

def setup
Expand Down
7 changes: 0 additions & 7 deletions test/functional/projects_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class ProjectsControllerTest < AdditionalTags::ControllerTest
fixtures :projects, :users,
:roles, :members, :member_roles,
:issues, :issue_statuses,
:versions, :trackers, :projects_trackers,
:issue_categories, :enabled_modules,
:dashboards

def setup
User.current = nil
end
Expand Down
19 changes: 0 additions & 19 deletions test/functional/timelog_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class TimelogControllerTest < AdditionalTags::ControllerTest
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:time_entries,
:additional_tags, :additional_taggings

def setup
prepare_tests
end
Expand Down
3 changes: 0 additions & 3 deletions test/functional/welcome_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class WelcomeControllerTest < AdditionalTags::ControllerTest
fixtures :projects, :news, :users, :members,
:dashboards

def setup
User.current = nil
end
Expand Down
6 changes: 0 additions & 6 deletions test/functional/wiki_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class WikiControllerTest < AdditionalTags::ControllerTest
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
:enabled_modules, :wikis, :wiki_pages, :wiki_contents,
:wiki_content_versions, :attachments,
:issues, :issue_statuses, :trackers,
:additional_tags, :additional_taggings

def setup
prepare_tests
User.current = nil
Expand Down
9 changes: 0 additions & 9 deletions test/integration/api_test/additional_tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
require File.expand_path '../../../test_helper', __FILE__
module ApiTest
class AdditionalTagsTest < AdditionalTags::ApiTest
fixtures :projects, :users, :roles,
:enabled_modules, :enumerations,
:projects, :projects_trackers, :enabled_modules,
:members, :member_roles,
:issues, :issue_statuses, :issue_categories,
:additional_tags, :additional_taggings

include AdditionalTags::TestHelper

def setup
super
prepare_tests
Expand Down
12 changes: 0 additions & 12 deletions test/integration/api_test/issues_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@

module ApiTest
class IssuesTest < AdditionalTags::ApiTest
fixtures :users, :email_addresses, :roles, :user_preferences,
:enumerations,
:projects, :projects_trackers, :enabled_modules,
:members, :member_roles,
:issues, :issue_statuses, :issue_categories,
:versions, :trackers,
:journals, :journal_details,
:attachments, :workflows, :time_entries,
:additional_tags, :additional_taggings

include AdditionalTags::TestHelper

def setup
super
prepare_tests
Expand Down
20 changes: 14 additions & 6 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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"

module AdditionalTags
Expand All @@ -35,26 +36,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[dashboards additional_tags additional_taggings]
end
end

class IntegrationTest < Redmine::IntegrationTest
extend PluginFixturesLoader
fixtures(*fixtures_list)
end

class ApiTest < Redmine::ApiTest::Base
include AdditionalTags::TestHelper
extend PluginFixturesLoader
fixtures(*fixtures_list)
end

class ControllerTest < Redmine::ControllerTest
include AdditionalTags::TestHelper
extend PluginFixturesLoader
fixtures(*fixtures_list)

def fixture_files_path
Rails.root.join('plugins/additional_tags/test/fixtures/files').to_s
Expand All @@ -64,5 +71,6 @@ def fixture_files_path
class TestCase < ActiveSupport::TestCase
include AdditionalTags::TestHelper
extend PluginFixturesLoader
fixtures(*fixtures_list)
end
end
7 changes: 0 additions & 7 deletions test/unit/additional_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class AdditionalTagTest < AdditionalTags::TestCase
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:additional_tags, :additional_taggings

def setup
@project = projects :projects_001
end
Expand Down
7 changes: 0 additions & 7 deletions test/unit/additional_tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class AdditionalTagsTest < AdditionalTags::TestCase
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:additional_tags, :additional_taggings

def setup
@project = projects :projects_001
end
Expand Down
21 changes: 0 additions & 21 deletions test/unit/issue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class IssueTest < AdditionalTags::TestCase
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:time_entries,
:journals, :journal_details,
:additional_tags, :additional_taggings

def setup
# run as the admin
User.stubs(:current).returns(users(:users_001))
Expand Down
8 changes: 0 additions & 8 deletions test/unit/query_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 QueryTest < AdditionalTags::TestCase
fixtures :projects, :users, :members, :member_roles, :roles,
:issue_statuses, :enumerations,
:groups_users,
:trackers, :projects_trackers,
:enabled_modules,
:roles,
:additional_tags, :additional_taggings

def setup
Issue.destroy_all
Issue.generate! project_id: 1, tag_list: ['First Issue'] # eCookBook
Expand Down
22 changes: 0 additions & 22 deletions test/unit/tags_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,6 @@
require File.expand_path '../../test_helper', __FILE__

class TagsTest < AdditionalTags::TestCase
fixtures :projects,
:users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields, :custom_values, :custom_fields_projects, :custom_fields_trackers,
:time_entries,
:wikis, :wiki_pages, :wiki_contents, :wiki_content_versions,
:journals, :journal_details,
:additional_tags, :additional_taggings

def setup
prepare_tests
@project = projects :projects_001
Expand Down
Loading

0 comments on commit 38883dd

Please sign in to comment.