summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-10-02 00:53:11 +0000
committerGo MAEDA <maeda@farend.jp>2019-10-02 00:53:11 +0000
commit545a050ba318f09890b6baf6934face7e958ea88 (patch)
tree476d0fe4afb49930f50564f5fd72cbf1a85a48c3 /test/unit
parentfff145a49dac4266a4699de204f835819e42e7ae (diff)
downloadredmine-545a050ba318f09890b6baf6934face7e958ea88.tar.gz
redmine-545a050ba318f09890b6baf6934face7e958ea88.zip
Code cleanup: RuboCop: Fix Performance/Count and Performance/Detect.
This change corrects newly detected offenses after updating rubocop-performance to 1.5.0 in r18579. git-svn-id: http://svn.redmine.org/redmine/trunk@18580 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/issue_test.rb2
-rw-r--r--test/unit/project_copy_test.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index baedfec0f..0c3315459 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2499,7 +2499,7 @@ class IssueTest < ActiveSupport::TestCase
assert_equal 2, assignable_user_ids.length
assignable_user_ids.each do |user_id|
- assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length,
+ assert_equal 1, assignable_user_ids.count {|i| i == user_id},
"User #{user_id} appears more or less than once"
end
end
diff --git a/test/unit/project_copy_test.rb b/test/unit/project_copy_test.rb
index fb07d6b65..af56c15a9 100644
--- a/test/unit/project_copy_test.rb
+++ b/test/unit/project_copy_test.rb
@@ -200,7 +200,7 @@ class ProjectCopyTest < ActiveSupport::TestCase
# Second issue with a cross project relation
assert_equal 2, copied_second_issue.relations.size, "Relation not copied"
- copied_relation = copied_second_issue.relations.select {|r| r.relation_type == 'duplicates'}.first
+ copied_relation = copied_second_issue.relations.find {|r| r.relation_type == 'duplicates'}
assert_equal "duplicates", copied_relation.relation_type
assert_equal 1, copied_relation.issue_from_id, "Cross project relation not kept"
assert_not_equal source_relation_cross_project.id, copied_relation.id