Autofix Rubocop Rails/Pluck (#23730)
This commit is contained in:
parent
597767a9f7
commit
21bf326356
7 changed files with 14 additions and 25 deletions
|
@ -70,19 +70,19 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'includes reblog' do
|
||||
expect(body_as_json.map { |x| x[:type] }).to include 'reblog'
|
||||
expect(body_as_json.pluck(:type)).to include 'reblog'
|
||||
end
|
||||
|
||||
it 'includes mention' do
|
||||
expect(body_as_json.map { |x| x[:type] }).to include 'mention'
|
||||
expect(body_as_json.pluck(:type)).to include 'mention'
|
||||
end
|
||||
|
||||
it 'includes favourite' do
|
||||
expect(body_as_json.map { |x| x[:type] }).to include 'favourite'
|
||||
expect(body_as_json.pluck(:type)).to include 'favourite'
|
||||
end
|
||||
|
||||
it 'includes follow' do
|
||||
expect(body_as_json.map { |x| x[:type] }).to include 'follow'
|
||||
expect(body_as_json.pluck(:type)).to include 'follow'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -125,7 +125,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
|
|||
|
||||
it 'returns everything but excluded type' do
|
||||
expect(body_as_json.size).to_not eq 0
|
||||
expect(body_as_json.map { |x| x[:type] }.uniq).to_not include 'mention'
|
||||
expect(body_as_json.pluck(:type).uniq).to_not include 'mention'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -139,7 +139,7 @@ RSpec.describe Api::V1::NotificationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'returns only requested type' do
|
||||
expect(body_as_json.map { |x| x[:type] }.uniq).to eq ['mention']
|
||||
expect(body_as_json.pluck(:type).uniq).to eq ['mention']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe Api::V1::SuggestionsController, type: :controller do
|
|||
json = body_as_json
|
||||
|
||||
expect(json.size).to be >= 1
|
||||
expect(json.map { |i| i[:id] }).to include(*[bob, jeff].map { |i| i.id.to_s })
|
||||
expect(json.pluck(:id)).to include(*[bob, jeff].map { |i| i.id.to_s })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue