diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-30 14:21:26 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-30 14:21:26 +0200 |
commit | 0c6f04427b550a600cdd78a20ffe5c3b6602ff72 (patch) | |
tree | c5c71ea253c8dfd38ac90355e817412ddc74617f | |
parent | 43c35b0f20fb3bb67ea2b96bf8f806c7e95b6aec (diff) | |
download | gitlab-ce-0c6f04427b550a600cdd78a20ffe5c3b6602ff72.tar.gz |
Enable Performance/TimesMap Rubocop coprubocop/enable-performance-times-map-cop
Use Array.new with a block instead of `.times.collect` / `.times.map`.
See #17478
-rw-r--r-- | .rubocop.yml | 3 | ||||
-rw-r--r-- | spec/services/issues/bulk_update_service_spec.rb | 9 |
2 files changed, 3 insertions, 9 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 2d8eb4077f3..d89112e7eb7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1027,10 +1027,9 @@ Performance/StartWith: Performance/StringReplacement: Enabled: true -# TODO: Enable TimesMap Cop. # Checks for `.times.map` calls. Performance/TimesMap: - Enabled: false + Enabled: true ##################### Rails ################################## diff --git a/spec/services/issues/bulk_update_service_spec.rb b/spec/services/issues/bulk_update_service_spec.rb index e91906d0d49..96f050bbd9b 100644 --- a/spec/services/issues/bulk_update_service_spec.rb +++ b/spec/services/issues/bulk_update_service_spec.rb @@ -15,9 +15,7 @@ describe Issues::BulkUpdateService, services: true do describe :close_issue do before do - @issues = 5.times.collect do - create(:issue, project: @project) - end + @issues = create_list(:issue, 5, project: @project) @params = { state_event: 'close', issues_ids: @issues.map(&:id) @@ -36,11 +34,8 @@ describe Issues::BulkUpdateService, services: true do end describe :reopen_issues do - before do - @issues = 5.times.collect do - create(:closed_issue, project: @project) - end + @issues = create_list(:closed_issue, 5, project: @project) @params = { state_event: 'reopen', issues_ids: @issues.map(&:id) |