mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
fixtures :all
This commit is contained in:
parent
5cae951d24
commit
6bf436f19f
@ -24,8 +24,7 @@ AllCops:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- '**/vendor/**/*'
|
- '**/vendor/**/*'
|
||||||
|
|
||||||
# Enable extensions
|
plugins:
|
||||||
require:
|
|
||||||
- rubocop-performance
|
- rubocop-performance
|
||||||
- rubocop-rails
|
- rubocop-rails
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Attachment controller patch test
|
# Attachment controller patch test
|
||||||
class AttachmentsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
class AttachmentsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
fixtures :attachments, :enabled_modules, :custom_workflows, :custom_workflows_projects,
|
|
||||||
:roles, :members, :member_roles
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Custom workflows controller test
|
# Custom workflows controller test
|
||||||
class CustomWorkflowsControllerTest < RedmineCustomWorkflows::Test::TestCase
|
class CustomWorkflowsControllerTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
fixtures :custom_workflows
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -22,7 +22,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
# Group controller patch test
|
# Group controller patch test
|
||||||
class GroupControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
class GroupControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
fixtures :custom_workflows, :custom_workflows_projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issue relation controller patch test
|
# Issue relation controller patch test
|
||||||
class IssueRelationsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
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
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issue controller patch test
|
# Issue controller patch test
|
||||||
class IssuesControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
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
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Users controller patch test
|
# Users controller patch test
|
||||||
class MembersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
class MembersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
fixtures :user_preferences, :roles, :members, :member_roles, :custom_workflows, :custom_workflows_projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Project controller patch test
|
# Project controller patch test
|
||||||
class ProjectsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
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
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Time controller patch test
|
# Time controller patch test
|
||||||
class TimelogControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
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
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Users controller patch test
|
# Users controller patch test
|
||||||
class UsersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
class UsersControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
fixtures :custom_workflows, :custom_workflows_projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Version controller patch test
|
# Version controller patch test
|
||||||
class VersionsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
class VersionsControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
||||||
fixtures :versions, :custom_workflows, :custom_workflows_projects, :roles, :members, :member_roles
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Wiki controller patch test
|
# Wiki controller patch test
|
||||||
class WikiControllerPatchTest < RedmineCustomWorkflows::Test::TestCase
|
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
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,23 +21,17 @@ module RedmineCustomWorkflows
|
|||||||
module Test
|
module Test
|
||||||
# Test case base class
|
# Test case base class
|
||||||
class TestCase < ActionDispatch::IntegrationTest
|
class TestCase < ActionDispatch::IntegrationTest
|
||||||
fixtures :users, :email_addresses, :projects
|
|
||||||
|
|
||||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
def initialize(name)
|
||||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
super(name)
|
||||||
# and allowing us to suppliment redmine fixtures if we need to.
|
# Load all plugin's fixtures
|
||||||
def self.fixtures(*table_names)
|
|
||||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
redmine_table_names = []
|
ext = '.yml'
|
||||||
table_names.each do |x|
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
fixture = File.basename(file, ext)
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
else
|
|
||||||
redmine_table_names << x
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
super(redmine_table_names) if redmine_table_names.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@jsmith = User.find_by(login: 'jsmith')
|
@jsmith = User.find_by(login: 'jsmith')
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Attachment patch test class
|
# Attachment patch test class
|
||||||
class AttachmentPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class AttachmentPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :attachments
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@attachment1 = Attachment.find 1
|
@attachment1 = Attachment.find 1
|
||||||
|
|||||||
@ -22,7 +22,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
# Custom mailer test class
|
# Custom mailer test class
|
||||||
class CustomWorkflowMailerTest < RedmineCustomWorkflows::Test::UnitTest
|
class CustomWorkflowMailerTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
fixtures :users, :email_addresses
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@user2 = User.find 2
|
@user2 = User.find 2
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Custom workflow test class
|
# Custom workflow test class
|
||||||
class CustomWorkflowTest < RedmineCustomWorkflows::Test::UnitTest
|
class CustomWorkflowTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :projects, :custom_workflows, :custom_workflows_projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@cw1 = CustomWorkflow.find 1
|
@cw1 = CustomWorkflow.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Group patch test class
|
# Group patch test class
|
||||||
class GroupPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class GroupPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :users
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@group10 = Group.find 10
|
@group10 = Group.find 10
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issue patch test class
|
# Issue patch test class
|
||||||
class IssuePatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class IssuePatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :issues
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@issue1 = Issue.find 1
|
@issue1 = Issue.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issue relation patch test class
|
# Issue relation patch test class
|
||||||
class IssueRelationPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class IssueRelationPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :issue_relations
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@issue_relation1 = IssueRelation.find 1
|
@issue_relation1 = IssueRelation.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Member patch test class
|
# Member patch test class
|
||||||
class MemberPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class MemberPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :members
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@member1 = Member.find 1
|
@member1 = Member.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Project patch test class
|
# Project patch test class
|
||||||
class ProjectPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class ProjectPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@project1 = Project.find 1
|
@project1 = Project.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Time entry patch test class
|
# Time entry patch test class
|
||||||
class TimeEntryPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class TimeEntryPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :time_entries
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@time_entry1 = TimeEntry.find 1
|
@time_entry1 = TimeEntry.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# User patch test class
|
# User patch test class
|
||||||
class UserPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class UserPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :users
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@user1 = User.find 1
|
@user1 = User.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Version patch test class
|
# Version patch test class
|
||||||
class VersionPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class VersionPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :versions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@version1 = Version.find 1
|
@version1 = Version.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Wiki content patch test class
|
# Wiki content patch test class
|
||||||
class WikiContentPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class WikiContentPatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :wiki_contents
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wiki_content1 = WikiContent.find 1
|
@wiki_content1 = WikiContent.find 1
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Wiki page test class
|
# Wiki page test class
|
||||||
class WikiPagePatchTest < RedmineCustomWorkflows::Test::UnitTest
|
class WikiPagePatchTest < RedmineCustomWorkflows::Test::UnitTest
|
||||||
fixtures :wiki_pages
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wiki_page1 = WikiPage.find 1
|
@wiki_page1 = WikiPage.find 1
|
||||||
|
|||||||
@ -21,15 +21,16 @@ module RedmineCustomWorkflows
|
|||||||
module Test
|
module Test
|
||||||
# Unit test base class
|
# Unit test base class
|
||||||
class UnitTest < ActiveSupport::TestCase
|
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,
|
def initialize(name)
|
||||||
# and allowing us to suppliment redmine fixtures if we need to.
|
super(name)
|
||||||
def self.fixtures(*table_names)
|
# Load all plugin's fixtures
|
||||||
dir = File.join(File.dirname(__FILE__), '/fixtures')
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
table_names.each do |x|
|
ext = '.yml'
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml")
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
|
fixture = File.basename(file, ext)
|
||||||
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
end
|
end
|
||||||
super(table_names)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user