summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-12-26 02:46:53 +0000
committerGo MAEDA <maeda@farend.jp>2022-12-26 02:46:53 +0000
commit10af27eac346b6f055586ab859a62ab664713474 (patch)
tree617cbc9dc0ad8caa52471a42f011a741723ed914
parent8e83bba72019e9ae0bf4d4b1b35ee68cadfab09e (diff)
downloadredmine-10af27eac346b6f055586ab859a62ab664713474.tar.gz
redmine-10af27eac346b6f055586ab859a62ab664713474.zip
Fix RuboCop offense Performance/StringInclude (#37247).
git-svn-id: https://svn.redmine.org/redmine/trunk@22003 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--.rubocop_todo.yml8
-rw-r--r--test/functional/versions_controller_test.rb2
-rw-r--r--test/integration/sessions_test.rb4
-rw-r--r--test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb2
-rw-r--r--test/unit/lib/redmine/wiki_formatting/macros_test.rb2
5 files changed, 5 insertions, 13 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index a5d9b2e6b..992d9ece9 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -560,14 +560,6 @@ Performance/RedundantSplitRegexpArgument:
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
-Performance/StringInclude:
- Exclude:
- - 'test/functional/versions_controller_test.rb'
- - 'test/integration/sessions_test.rb'
- - 'test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb'
- - 'test/unit/lib/redmine/wiki_formatting/macros_test.rb'
-
-# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: OnlySumOrWithInitialValue.
Performance/Sum:
Exclude:
diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb
index fdd767560..d872f62eb 100644
--- a/test/functional/versions_controller_test.rb
+++ b/test/functional/versions_controller_test.rb
@@ -336,7 +336,7 @@ class VersionsControllerTest < Redmine::ControllerTest
end
assert_redirected_to :controller => 'projects', :action => 'settings',
:tab => 'versions', :id => 'ecookbook'
- assert flash[:error].match(/Unable to delete version/)
+ assert flash[:error].include?('Unable to delete version')
assert Version.find_by_id(2)
end
diff --git a/test/integration/sessions_test.rb b/test/integration/sessions_test.rb
index 93b8988c5..e78de7f26 100644
--- a/test/integration/sessions_test.rb
+++ b/test/integration/sessions_test.rb
@@ -39,7 +39,7 @@ class SessionsTest < Redmine::IntegrationTest
get '/my/account'
assert_response 302
- assert flash[:error].match(/Your session has expired/)
+ assert flash[:error].include?('Your session has expired')
end
def test_lock_user_kills_sessions
@@ -51,7 +51,7 @@ class SessionsTest < Redmine::IntegrationTest
get '/my/account'
assert_response 302
- assert flash[:error].match(/Your session has expired/)
+ assert flash[:error].include?('Your session has expired')
end
def test_update_user_does_not_kill_sessions
diff --git a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb
index 0bef95141..16e5c1895 100644
--- a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb
@@ -42,7 +42,7 @@ class BazaarAdapterTest < ActiveSupport::TestCase
def test_cat
cat = @adapter.cat('directory/document.txt')
- assert cat =~ /Write the contents of a file as of a given revision to standard output/
+ assert cat.include?('Write the contents of a file as of a given revision to standard output')
end
def test_cat_path_invalid
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
index 28be28d47..278a6815e 100644
--- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
@@ -211,7 +211,7 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
def test_macro_hello_world
text = "{{hello_world}}"
- assert textilizable(text).match(/Hello world!/)
+ assert textilizable(text).include?('Hello world!')
end
def test_macro_hello_world_should_escape_arguments