diff --git a/.rubocop.yml b/.rubocop.yml index 86c0202..ea1944a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -717,7 +717,7 @@ Style/LineEndConcatenation: line end. Enabled: true -Style/MethodCallParentheses: +Style/MethodCallWithoutArgsParentheses: Description: 'Do not use parentheses for method calls with no arguments.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens' Enabled: true diff --git a/lib/intouch/patches/projects_helper_patch.rb b/lib/intouch/patches/projects_helper_patch.rb index 5c8204d..83ed416 100644 --- a/lib/intouch/patches/projects_helper_patch.rb +++ b/lib/intouch/patches/projects_helper_patch.rb @@ -4,24 +4,35 @@ module Intouch module Patches module ProjectsHelperPatch - def project_settings_tabs - tabs = super + def self.included(base) + base.send(:include, MethodsPatch) - return tabs unless User.current.allowed_to?(:manage_intouch_settings, @project) + base.class_eval do + unloadable - tabs.push( - name: 'intouch_settings', - action: :manage_intouch_settings, - partial: 'projects/settings/intouch/settings', - label: 'intouch.label.settings' - ) + alias_method_chain :project_settings_tabs, :intouch + end + end + + module MethodsPatch + def project_settings_tabs_with_intouch + tabs = project_settings_tabs_without_intouch + + return tabs unless User.current.allowed_to?(:manage_intouch_settings, @project) - tabs + tabs.push( + name: 'intouch_settings', + action: :manage_intouch_settings, + partial: 'projects/settings/intouch/settings', + label: 'intouch.label.settings' + ) + + tabs + end end end end end - -ProjectsHelper.send(:prepend, Intouch::Patches::ProjectsHelperPatch) +ProjectsHelper.send(:include, Intouch::Patches::ProjectsHelperPatch) ProjectsHelper.send(:include, IntouchHelper) diff --git a/test/test_helper.rb b/test/test_helper.rb index 2728bf7..73f26f3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ -$VERBOSE = nil # for hide ruby warnings - -# Load the Redmine helper -require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') -require "minitest/reporters" - -Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new +$VERBOSE = nil # for hide ruby warnings + +# Load the Redmine helper +require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') +require 'minitest/reporters' + +Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new