summaryrefslogtreecommitdiffstats
path: root/test/unit/enumeration_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-08-23 09:05:20 +0000
committerGo MAEDA <maeda@farend.jp>2023-08-23 09:05:20 +0000
commit21a6fc71d6806dc74e087de4cbf7b4acf3b8a3ba (patch)
tree5e205ca3488eb4301266fcdbccfde2a444be0e33 /test/unit/enumeration_test.rb
parent86c5d7814f4c3e860e449cdda05717984ca21405 (diff)
downloadredmine-21a6fc71d6806dc74e087de4cbf7b4acf3b8a3ba.tar.gz
redmine-21a6fc71d6806dc74e087de4cbf7b4acf3b8a3ba.zip
Fix RuboCop offense Performance/MapMethodChain (#37247).
git-svn-id: https://svn.redmine.org/redmine/trunk@22280 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/enumeration_test.rb')
-rw-r--r--test/unit/enumeration_test.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb
index a9d0e8eb3..ad516b615 100644
--- a/test/unit/enumeration_test.rb
+++ b/test/unit/enumeration_test.rb
@@ -141,7 +141,7 @@ class EnumerationTest < ActiveSupport::TestCase
b = IssuePriority.create!(:name => 'B')
c = DocumentCategory.create!(:name => 'C')
- assert_equal [1, 2, 1], [a, b, c].map(&:reload).map(&:position)
+ assert_equal [1, 2, 1], [a, b, c].map {|e| e.reload.position}
end
def test_override_should_be_created_with_same_position_as_parent
@@ -151,7 +151,7 @@ class EnumerationTest < ActiveSupport::TestCase
b = IssuePriority.create!(:name => 'B')
override = IssuePriority.create!(:name => 'BB', :parent_id => b.id)
- assert_equal [1, 2, 2], [a, b, override].map(&:reload).map(&:position)
+ assert_equal [1, 2, 2], [a, b, override].map {|e| e.reload.position}
end
def test_override_position_should_be_updated_with_parent_position
@@ -163,7 +163,7 @@ class EnumerationTest < ActiveSupport::TestCase
b.position -= 1
b.save!
- assert_equal [2, 1, 1], [a, b, override].map(&:reload).map(&:position)
+ assert_equal [2, 1, 1], [a, b, override].map {|e| e.reload.position}
end
def test_destroying_override_should_not_update_positions
@@ -174,10 +174,10 @@ class EnumerationTest < ActiveSupport::TestCase
b = IssuePriority.create!(:name => 'B')
c = IssuePriority.create!(:name => 'C')
override = IssuePriority.create!(:name => 'BB', :parent_id => b.id)
- assert_equal [1, 2, 3, 2], [a, b, c, override].map(&:reload).map(&:position)
+ assert_equal [1, 2, 3, 2], [a, b, c, override].map {|e| e.reload.position}
override.destroy
- assert_equal [1, 2, 3], [a, b, c].map(&:reload).map(&:position)
+ assert_equal [1, 2, 3], [a, b, c].map {|e| e.reload.position}
end
def test_spaceship_operator_with_incomparable_value_should_return_nil