Fix test name and some cleanups
This commit is contained in:
parent
2fa76795b5
commit
1356748948
@ -9,12 +9,12 @@ module Additionals
|
||||
|
||||
class << self
|
||||
def setup
|
||||
incompatible_plugins(%w[redmine_issue_control_panel
|
||||
incompatible_plugins %w[redmine_issue_control_panel
|
||||
redmine_editauthor
|
||||
redmine_changeauthor
|
||||
redmine_auto_watch])
|
||||
redmine_auto_watch]
|
||||
|
||||
patch(%w[AccountController
|
||||
patch %w[AccountController
|
||||
ApplicationController
|
||||
AutoCompletesController
|
||||
Issue
|
||||
@ -29,7 +29,7 @@ module Additionals
|
||||
QueryFilter
|
||||
Role
|
||||
User
|
||||
UserPreference])
|
||||
UserPreference]
|
||||
|
||||
Redmine::WikiFormatting.format_names.each do |format|
|
||||
case format
|
||||
@ -42,10 +42,10 @@ module Additionals
|
||||
end
|
||||
end
|
||||
|
||||
IssuesController.send(:helper, AdditionalsIssuesHelper)
|
||||
SettingsController.send(:helper, AdditionalsSettingsHelper)
|
||||
WikiController.send(:helper, AdditionalsWikiPdfHelper)
|
||||
CustomFieldsController.send(:helper, AdditionalsCustomFieldsHelper)
|
||||
IssuesController.send :helper, AdditionalsIssuesHelper
|
||||
SettingsController.send :helper, AdditionalsSettingsHelper
|
||||
WikiController.send :helper, AdditionalsWikiPdfHelper
|
||||
CustomFieldsController.send :helper, AdditionalsCustomFieldsHelper
|
||||
|
||||
# Static class patches
|
||||
Redmine::AccessControl.include Additionals::Patches::AccessControlPatch
|
||||
@ -60,10 +60,10 @@ module Additionals
|
||||
require_dependency 'additionals/hooks'
|
||||
|
||||
# Macros
|
||||
load_macros(%w[cryptocompare date fa gist gmap google_docs group_users iframe
|
||||
load_macros %w[cryptocompare date fa gist gmap google_docs group_users iframe
|
||||
issue redmine_issue redmine_wiki
|
||||
last_updated_at last_updated_by meteoblue member new_issue project
|
||||
recently_updated reddit slideshare tradingview twitter user vimeo youtube asciinema])
|
||||
recently_updated reddit slideshare tradingview twitter user vimeo youtube asciinema]
|
||||
end
|
||||
|
||||
def settings_compatible(plugin_name)
|
||||
@ -88,7 +88,7 @@ module Additionals
|
||||
end
|
||||
|
||||
def setting?(value)
|
||||
true?(setting(value))
|
||||
true? setting(value)
|
||||
end
|
||||
|
||||
def true?(value)
|
||||
@ -133,10 +133,10 @@ module Additionals
|
||||
|
||||
def load_settings(plugin_id = 'additionals')
|
||||
cached_settings_name = "@load_settings_#{plugin_id}"
|
||||
cached_settings = instance_variable_get(cached_settings_name)
|
||||
cached_settings = instance_variable_get cached_settings_name
|
||||
if cached_settings.nil?
|
||||
data = YAML.safe_load(ERB.new(IO.read(Rails.root.join("plugins/#{plugin_id}/config/settings.yml"))).result) || {}
|
||||
instance_variable_set(cached_settings_name, data.symbolize_keys)
|
||||
instance_variable_set cached_settings_name, data.symbolize_keys
|
||||
else
|
||||
cached_settings
|
||||
end
|
||||
@ -146,7 +146,7 @@ module Additionals
|
||||
value = nil
|
||||
if options.key? field
|
||||
value = options[field]
|
||||
options.delete(field)
|
||||
options.delete field
|
||||
elsif !default.nil?
|
||||
value = default
|
||||
end
|
||||
@ -156,7 +156,7 @@ module Additionals
|
||||
private
|
||||
|
||||
def settings
|
||||
settings_compatible(:plugin_additionals)
|
||||
settings_compatible :plugin_additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -58,7 +58,7 @@ class UserTest < Additionals::TestCase
|
||||
assert User.where(sudoer: true).first.can_be_admin?
|
||||
end
|
||||
|
||||
def test_non_sudoer_without_admin_should_can_not_be_admin
|
||||
def test_non_sudoer_without_admin_can_not_be_admin
|
||||
skip 'Skip redmine_sudo test, because redmine_contacts is not installed' unless Redmine::Plugin.installed?('redmine_sudo')
|
||||
|
||||
assert_not User.where(sudoer: false, admin: false).first.can_be_admin?
|
||||
|
Loading…
x
Reference in New Issue
Block a user