diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-07-24 08:19:15 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-07-24 08:19:15 +0000 |
commit | 163a43629c9018beb5f2a474ce63a0065445471b (patch) | |
tree | 3081baef63fcb1bdc30c35972793e49b750be859 /spec/services/issuable | |
parent | 2524cb1016cc54b82bcbf01e4df5fad46b980912 (diff) | |
download | gitlab-ce-163a43629c9018beb5f2a474ce63a0065445471b.tar.gz |
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.rb | 10 |
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 |