Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2019-07-24 11:19:15 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-07-24 11:19:15 +0300
commit163a43629c9018beb5f2a474ce63a0065445471b (patch)
tree3081baef63fcb1bdc30c35972793e49b750be859 /spec/lib/gitlab/database_importers
parent2524cb1016cc54b82bcbf01e4df5fad46b980912 (diff)
Prefer `flat_map` over `map` + `flatten` in specs
Although `flat_map` is equivalent to `map` + `flatten(1)` (note the level 1) we can apply this same refactoring to all cases.
Diffstat (limited to 'spec/lib/gitlab/database_importers')
-rw-r--r--spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb b/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb
index 57c8bafd488..eed2a1b7b48 100644
--- a/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb
+++ b/spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb
@@ -7,8 +7,8 @@ describe Gitlab::DatabaseImporters::CommonMetrics::Importer do
context "does import common_metrics.yml" do
let(:groups) { subject.content['panel_groups'] }
- let(:panels) { groups.map { |group| group['panels'] }.flatten }
- let(:metrics) { panels.map { |group| group['metrics'] }.flatten }
+ let(:panels) { groups.flat_map { |group| group['panels'] } }
+ let(:metrics) { panels.flat_map { |group| group['metrics'] } }
let(:metric_ids) { metrics.map { |metric| metric['id'] } }
before do