fixtures :all
This commit is contained in:
parent
02e699655b
commit
5fcede685a
2
.github/workflows/rubyonrails.yml
vendored
2
.github/workflows/rubyonrails.yml
vendored
@ -140,7 +140,9 @@ jobs:
|
||||
- name: Helpers tests
|
||||
run: |
|
||||
cd /opt/redmine
|
||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_files_helper_test.rb
|
||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_helper_test.rb
|
||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_links_helper_test.rb
|
||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_queries_helper_test.rb
|
||||
- name: Rubocop
|
||||
# Run the Rubocop tests
|
||||
|
||||
@ -26,8 +26,7 @@ AllCops:
|
||||
Exclude:
|
||||
- '**/vendor/**/*'
|
||||
|
||||
# Enable extensions
|
||||
require:
|
||||
plugins:
|
||||
- rubocop-performance
|
||||
- rubocop-rails
|
||||
|
||||
|
||||
@ -117,6 +117,7 @@ module RedmineDmsf
|
||||
|
||||
file = DmsfFile.visible.find_by(id: args[0])
|
||||
return "{{dmsfversion(#{args[0]})}}" unless file
|
||||
|
||||
unless User.current&.allowed_to?(:view_dmsf_files, file.project, { id: file.id })
|
||||
raise ::I18n.t(:notice_not_authorized)
|
||||
end
|
||||
@ -127,7 +128,7 @@ module RedmineDmsf
|
||||
revision = DmsfFileRevision.find_by(id: args[1], dmsf_file_id: args[0])
|
||||
return "{{dmsfversion(#{args[0]}, #{args[1]})}}" unless revision
|
||||
end
|
||||
textilizable revision.version
|
||||
revision.version
|
||||
end
|
||||
|
||||
# dmsflastupdate - text referring to the document's last update date
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_links, :dmsf_locks
|
||||
|
||||
def setup
|
||||
super
|
||||
@file_link2 = DmsfLink.find 2
|
||||
|
||||
@ -25,9 +25,6 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
include DmsfHelper
|
||||
|
||||
fixtures :custom_fields, :custom_values, :dmsf_links, :dmsf_folder_permissions, :dmsf_locks,
|
||||
:dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@link2 = DmsfLink.find 2
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# DmsfFiles controller
|
||||
class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def teardown
|
||||
super
|
||||
DmsfFile.clear_previews
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Folder permissions controller
|
||||
class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase
|
||||
fixtures :dmsf_folder_permissions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Help controller
|
||||
class DmsfHelpControllerTest < RedmineDmsf::Test::TestCase
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_wiki_syntax
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
get '/dmsf/help/wiki_syntax'
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@file_link = DmsfLink.find 1
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Public URL controller
|
||||
class DmsfPublicUrlsControllerTest < RedmineDmsf::Test::TestCase
|
||||
fixtures :dmsf_public_urls, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_show_valid_url
|
||||
get '/dmsf_public_urls', params: { token: 'd8d33e21914a433b280fdc94450ee212' }
|
||||
assert_response :success
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfStateControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :queries
|
||||
|
||||
def setup
|
||||
super
|
||||
@query401 = Query.find 401
|
||||
|
||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
||||
:dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def setup
|
||||
super
|
||||
@wfs1 = DmsfWorkflowStep.find 1 # step 1
|
||||
|
||||
@ -21,10 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Issues controller
|
||||
class IssuesControllerTest < RedmineDmsf::Test::TestCase
|
||||
fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :issue_statuses,
|
||||
:enabled_modules, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :enumerations,
|
||||
:issue_categories
|
||||
|
||||
def setup
|
||||
super
|
||||
@issue1 = Issue.find 1
|
||||
|
||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class MyControllerTest < RedmineDmsf::Test::TestCase
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :user_preferences, :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
||||
:dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def test_page_with_open_approvals_one_approval
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
DmsfFileRevision.where(id: 5).delete_all
|
||||
|
||||
@ -21,22 +21,15 @@ module RedmineDmsf
|
||||
module Test
|
||||
# Helper test
|
||||
class HelperTest < ActiveSupport::TestCase
|
||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
||||
|
||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
||||
# and allowing us to suppliment redmine fixtures if we need to.
|
||||
def self.fixtures(*table_names)
|
||||
def initialize(name)
|
||||
super(name)
|
||||
# Load all plugin's fixtures
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
redmine_table_names = []
|
||||
table_names.each do |x|
|
||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
||||
else
|
||||
redmine_table_names << x
|
||||
end
|
||||
ext = '.yml'
|
||||
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||
fixture = File.basename(file, ext)
|
||||
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||
end
|
||||
super(redmine_table_names) if redmine_table_names.any?
|
||||
end
|
||||
|
||||
def setup
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfHelperTest < RedmineDmsf::Test::HelperTest
|
||||
include DmsfHelper
|
||||
|
||||
fixtures :dmsf_folders
|
||||
|
||||
def setup
|
||||
super
|
||||
@folder1 = DmsfFolder.find 1
|
||||
|
||||
@ -25,8 +25,6 @@ class DmsfQueriesHelperTest < RedmineDmsf::Test::HelperTest
|
||||
include ActionView::Helpers::NumberHelper
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
fixtures :dmsf_folders
|
||||
|
||||
def setup
|
||||
@folder1 = DmsfFolder.find 1
|
||||
super
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :dmsf_links
|
||||
|
||||
def setup
|
||||
super
|
||||
Setting.rest_api_enabled = '1'
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :custom_fields
|
||||
|
||||
def setup
|
||||
super
|
||||
Setting.rest_api_enabled = '1'
|
||||
|
||||
@ -23,9 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :dmsf_links, :custom_fields,
|
||||
:custom_values
|
||||
|
||||
def setup
|
||||
super
|
||||
Setting.rest_api_enabled = '1'
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
class DmsfLinkApiTest < RedmineDmsf::Test::IntegrationTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_files, :dmsf_file_revisions, :dmsf_links
|
||||
|
||||
def setup
|
||||
super
|
||||
Setting.rest_api_enabled = '1'
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# Custom middleware test
|
||||
class DmsfWebdavCustomMiddlewareTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files
|
||||
|
||||
def test_options_for_root_path
|
||||
process :options, '/'
|
||||
assert_response :method_not_allowed
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def test_not_authenticated
|
||||
delete '/dmsf/webdav'
|
||||
assert_response :unauthorized
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# WebDAV GET test
|
||||
class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_should_deny_anonymous
|
||||
get '/dmsf/webdav'
|
||||
assert_response :unauthorized
|
||||
|
||||
@ -21,7 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# WebDAV HEAD tests
|
||||
class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_head_requires_authentication
|
||||
head "/dmsf/webdav/#{@project1.identifier}"
|
||||
|
||||
@ -22,7 +22,6 @@ require 'fileutils'
|
||||
|
||||
# WebDAV LOCK test
|
||||
class DmsfWebdavLockTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def setup
|
||||
super
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# WebDAV MKCOL tests
|
||||
class DmsfWebdavMkcolTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders
|
||||
|
||||
def test_mkcol_requires_authentication
|
||||
process :mkcol, '/dmsf/webdav/test1'
|
||||
assert_response :unauthorized
|
||||
|
||||
@ -22,8 +22,6 @@ require 'fileutils'
|
||||
|
||||
# WebDAV MOVE tests
|
||||
class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_move_denied_for_anonymous
|
||||
new_name = "#{@file1.name}.moved"
|
||||
assert_no_difference '@file1.dmsf_file_revisions.count' do
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# WebDAV OPTIONS tests
|
||||
class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders
|
||||
|
||||
def test_options_requires_no_authentication_for_root_level
|
||||
process :options, '/dmsf/webdav'
|
||||
assert_response :success
|
||||
|
||||
@ -21,7 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
||||
|
||||
# WebDAV POST tests
|
||||
class DmsfWebdavPostTest < RedmineDmsf::Test::IntegrationTest
|
||||
# Test that any post request is authenticated
|
||||
def test_post_request_authenticated
|
||||
post '/dmsf/webdav/'
|
||||
assert_response :unauthorized
|
||||
|
||||
@ -22,8 +22,6 @@ require 'uri'
|
||||
|
||||
# WebDAV PROPFIND tests
|
||||
class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_propfind_denied_for_anonymous
|
||||
process :propfind, '/dmsf/webdav/', params: nil, headers: @anonymous.merge!({ HTTP_DEPTH: '0' })
|
||||
assert_response :unauthorized
|
||||
|
||||
@ -22,8 +22,6 @@ require 'fileutils'
|
||||
|
||||
# WebDAV PUT tests
|
||||
class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
||||
|
||||
def setup
|
||||
super
|
||||
@cv22 = CustomValue.find(22)
|
||||
|
||||
@ -22,8 +22,6 @@ require 'fileutils'
|
||||
|
||||
# WebDAV UNLOCK tests
|
||||
class DmsfWebdavUnlockTest < RedmineDmsf::Test::IntegrationTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
||||
|
||||
def test_unlock_file
|
||||
log_user 'admin', 'admin'
|
||||
l = @file2.locks.first
|
||||
|
||||
@ -21,7 +21,16 @@ module RedmineDmsf
|
||||
module Test
|
||||
# Integration test
|
||||
class IntegrationTest < Redmine::IntegrationTest
|
||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
||||
def initialize(name)
|
||||
super(name)
|
||||
# Load all plugin's fixtures
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
ext = '.yml'
|
||||
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||
fixture = File.basename(file, ext)
|
||||
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
@admin = credentials('admin', 'admin')
|
||||
@ -71,19 +80,6 @@ module RedmineDmsf
|
||||
Rails.logger.error e.message
|
||||
end
|
||||
|
||||
def self.fixtures(*table_names)
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
redmine_table_names = []
|
||||
table_names.each do |x|
|
||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
||||
else
|
||||
redmine_table_names << x
|
||||
end
|
||||
end
|
||||
super(redmine_table_names) if redmine_table_names.any?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def check_headers_exist
|
||||
|
||||
@ -21,22 +21,15 @@ module RedmineDmsf
|
||||
module Test
|
||||
# Test case
|
||||
class TestCase < ActionDispatch::IntegrationTest
|
||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
||||
|
||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
||||
# and allowing us to suppliment redmine fixtures if we need to.
|
||||
def self.fixtures(*table_names)
|
||||
def initialize(name)
|
||||
super(name)
|
||||
# Load all plugin's fixtures
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
redmine_table_names = []
|
||||
table_names.each do |x|
|
||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
||||
else
|
||||
redmine_table_names << x
|
||||
end
|
||||
ext = '.yml'
|
||||
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||
fixture = File.basename(file, ext)
|
||||
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||
end
|
||||
super(redmine_table_names) if redmine_table_names.any?
|
||||
end
|
||||
|
||||
def setup
|
||||
|
||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# File revision tests
|
||||
class CustomFieldDmsfFileFormatTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :custom_fields, :projects, :issues, :trackers
|
||||
def setup
|
||||
super
|
||||
User.current = @jsmith
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfFileRevisionTest < RedmineDmsf::Test::UnitTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_locks, :dmsf_workflows, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@revision1 = DmsfFileRevision.find 1
|
||||
|
||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# File tests
|
||||
class DmsfFileTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_locks, :issues, :dmsf_links, :dmsf_workflows, :dmsf_workflow_steps,
|
||||
:dmsf_workflow_step_assignments, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@issue1 = Issue.find 1
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Folder permissions tests
|
||||
class DmsfFolderPermissionTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_folder_permissions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@permission1 = DmsfFolderPermission.find 1
|
||||
|
||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Folder tests
|
||||
class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_folder_permissions, :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions,
|
||||
:dmsf_links
|
||||
|
||||
def setup
|
||||
super
|
||||
@link2 = DmsfLink.find 2
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Link tests
|
||||
class DmsfLinksTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
||||
|
||||
def test_create_folder_link
|
||||
folder_link = DmsfLink.new
|
||||
folder_link.target_project_id = @project1.id
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper.rb', __FILE__)
|
||||
|
||||
# Lock tests
|
||||
class DmsfLockTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@lock = DmsfLock.find 1
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_workflows, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@file1.notify_activate
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Public URL tests
|
||||
class DmsfPublicUrlsTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_public_urls, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@dmsf_public_url1 = DmsfPublicUrl.find 1
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Query tests
|
||||
class DmsfQueryTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :queries, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@query401 = Query.find 401
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Upload tests
|
||||
class DmsfUploadTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :projects
|
||||
|
||||
def setup
|
||||
super
|
||||
@uploaded = {
|
||||
|
||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfWorkflowStepActionTest < RedmineDmsf::Test::UnitTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_workflow_steps, :dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files,
|
||||
:dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
@wfsac1 = DmsfWorkflowStepAction.find 1
|
||||
@wfsac2 = DmsfWorkflowStepAction.find 2
|
||||
|
||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Workflow step assignment tests
|
||||
class WorkflowStepAssignmentTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_workflow_steps, :dmsf_workflow_step_assignments, :dmsf_folders, :dmsf_files,
|
||||
:dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
@wfsa1 = DmsfWorkflowStepAssignment.find 1
|
||||
@wfsa2 = DmsfWorkflowStepAssignment.find 2
|
||||
|
||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class DmsfWorkflowStepTest < RedmineDmsf::Test::UnitTest
|
||||
include Redmine::I18n
|
||||
|
||||
fixtures :dmsf_workflows, :dmsf_workflow_steps, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
@wfs1 = DmsfWorkflowStep.find 1
|
||||
@wfs2 = DmsfWorkflowStep.find 2
|
||||
|
||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Workflow tests
|
||||
class DmsfWorkflowTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_file_revisions, :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
||||
:dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
super
|
||||
@wf1 = DmsfWorkflow.find 1
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# Issue tests
|
||||
class IssuePatchTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :issues, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def setup
|
||||
@issue1 = Issue.find 1
|
||||
end
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../../../test_helper', __FILE__)
|
||||
|
||||
# Macros tests
|
||||
class DmsfMacrosTest < RedmineDmsf::Test::HelperTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
# Mock view context for macros
|
||||
class DmsfView
|
||||
include ApplicationHelper
|
||||
|
||||
@ -22,7 +22,6 @@ require File.expand_path('../../../../../lib/redmine_dmsf/dmsf_zip', __FILE__)
|
||||
|
||||
# Plugin tests
|
||||
class DmsfZipTest < RedmineDmsf::Test::HelperTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :attachments
|
||||
def setup
|
||||
@zip = RedmineDmsf::DmsfZip::Zip.new
|
||||
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# project tests
|
||||
class ProjectPatchTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_links, :dmsf_workflows, :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_project_has_dmsf_files
|
||||
assert @project1.respond_to?(:dmsf_files)
|
||||
end
|
||||
|
||||
@ -21,10 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# User tests
|
||||
class UserPatchTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_links, :dmsf_locks, :dmsf_workflows, :dmsf_workflow_steps,
|
||||
:dmsf_workflow_step_assignments, :dmsf_workflow_step_actions, :dmsf_folders,
|
||||
:dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
||||
|
||||
def test_remove_dmsf_references
|
||||
id = @jsmith.id
|
||||
@jsmith.destroy
|
||||
|
||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
# User preference tests
|
||||
class UserPreferencePatchTest < RedmineDmsf::Test::UnitTest
|
||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
||||
|
||||
def test_user_preference_has_dmsf_attachments_upload_choice
|
||||
assert @jsmith.pref.respond_to?(:dmsf_attachments_upload_choice)
|
||||
end
|
||||
|
||||
@ -21,7 +21,16 @@ module RedmineDmsf
|
||||
module Test
|
||||
# Unit test
|
||||
class UnitTest < ActiveSupport::TestCase
|
||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
||||
def initialize(name)
|
||||
super(name)
|
||||
# Load all plugin's fixtures
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
ext = '.yml'
|
||||
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||
fixture = File.basename(file, ext)
|
||||
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||
end
|
||||
end
|
||||
|
||||
def setup
|
||||
@admin = User.find_by(login: 'admin')
|
||||
@ -71,22 +80,6 @@ module RedmineDmsf
|
||||
Rails.logger.error e.message
|
||||
end
|
||||
|
||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
||||
# and allowing us to suppliment redmine fixtures if we need to.
|
||||
def self.fixtures(*table_names)
|
||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||
redmine_table_names = []
|
||||
table_names.each do |x|
|
||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
||||
else
|
||||
redmine_table_names << x
|
||||
end
|
||||
end
|
||||
super(redmine_table_names) if redmine_table_names.any?
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def last_email
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user