summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-01-17 01:38:27 +0000
committerGo MAEDA <maeda@farend.jp>2023-01-17 01:38:27 +0000
commit0b6f4c6811a4a4e823674e3bb8b970ee46a9194b (patch)
tree341119beb1c247727c68ba9913a7a2bfc3fa3006 /test
parent97d07eb28573060085352e0e9046be16e29f5bfd (diff)
downloadredmine-0b6f4c6811a4a4e823674e3bb8b970ee46a9194b.tar.gz
redmine-0b6f4c6811a4a4e823674e3bb8b970ee46a9194b.zip
Ruby 2.7: Fix RuboCop offense Performance/MapCompact (#38134).
git-svn-id: https://svn.redmine.org/redmine/trunk@22055 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb4
-rw-r--r--test/unit/query_test.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 5078dbf44..81fef052f 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1259,7 +1259,7 @@ class IssuesControllerTest < Redmine::ControllerTest
get(:index, :params => {:sort => 'assigned_to'})
assert_response :success
- assignees = issues_in_list.map(&:assigned_to).compact
+ assignees = issues_in_list.filter_map(&:assigned_to)
assert_equal assignees.sort, assignees
assert_select 'table.issues.sort-by-assigned-to.sort-asc'
end
@@ -1268,7 +1268,7 @@ class IssuesControllerTest < Redmine::ControllerTest
get(:index, :params => {:sort => 'assigned_to:desc'})
assert_response :success
- assignees = issues_in_list.map(&:assigned_to).compact
+ assignees = issues_in_list.filter_map(&:assigned_to)
assert_equal assignees.sort.reverse, assignees
assert_select 'table.issues.sort-by-assigned-to.sort-desc'
end
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 6c05c9b95..c2cbf6fee 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1940,13 +1940,13 @@ class QueryTest < ActiveSupport::TestCase
q.sort_criteria = [[c.name.to_s, 'asc']]
issues = q.issues
values =
- issues.collect do |i|
+ issues.filter_map do |i|
begin
Kernel.Float(i.custom_value_for(c.custom_field).to_s)
rescue
nil
end
- end.compact
+ end
assert !values.empty?
assert_equal values.sort, values
end