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/services/issuable
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/services/issuable')
-rw-r--r--spec/services/issuable/bulk_update_service_spec.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb
index 40da3d31408..fb12877fa05 100644
--- a/spec/services/issuable/bulk_update_service_spec.rb
+++ b/spec/services/issuable/bulk_update_service_spec.rb
@@ -265,7 +265,7 @@ describe Issuable::BulkUpdateService do
end
it 'removes the label IDs from all issues passed' do
- expect(issues.map(&:reload).map(&:label_ids).flatten).not_to include(merge_requests.id)
+ expect(issues.map(&:reload).flat_map(&:label_ids)).not_to include(merge_requests.id)
end
it 'does not update issues not passed in' do
@@ -297,11 +297,11 @@ describe Issuable::BulkUpdateService do
let(:remove_labels) { [regression] }
it 'removes the label IDs from all issues passed' do
- expect(issues.map(&:reload).map(&:label_ids).flatten).not_to include(regression.id)
+ expect(issues.map(&:reload).flat_map(&:label_ids)).not_to include(regression.id)
end
it 'ignores the label IDs parameter' do
- expect(issues.map(&:reload).map(&:label_ids).flatten).not_to include(merge_requests.id)
+ expect(issues.map(&:reload).flat_map(&:label_ids)).not_to include(merge_requests.id)
end
it 'does not update issues not passed in' do
@@ -320,11 +320,11 @@ describe Issuable::BulkUpdateService do
end
it 'removes the label IDs from all issues passed' do
- expect(issues.map(&:reload).map(&:label_ids).flatten).not_to include(merge_requests.id)
+ expect(issues.map(&:reload).flat_map(&:label_ids)).not_to include(merge_requests.id)
end
it 'ignores the label IDs parameter' do
- expect(issues.map(&:reload).map(&:label_ids).flatten).not_to include(regression.id)
+ expect(issues.map(&:reload).flat_map(&:label_ids)).not_to include(regression.id)
end
it 'does not update issues not passed in' do