1
0
Fork 0
forked from fedi/mastodon

Autofix Rubocop Style/SymbolProc (#23742)

This commit is contained in:
Nick Schonning 2023-02-20 01:58:46 -05:00 committed by GitHub
parent af4c95100c
commit 2c3c734bcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 12 deletions

View file

@ -2451,11 +2451,3 @@ Style/SymbolArray:
- 'spec/controllers/concerns/signature_verification_spec.rb' - 'spec/controllers/concerns/signature_verification_spec.rb'
- 'spec/fabricators/notification_fabricator.rb' - 'spec/fabricators/notification_fabricator.rb'
- 'spec/models/public_feed_spec.rb' - 'spec/models/public_feed_spec.rb'
# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method, mail, respond_to
Style/SymbolProc:
Exclude:
- 'spec/lib/request_spec.rb'

View file

@ -97,12 +97,12 @@ describe Request do
describe "response's body_with_limit method" do describe "response's body_with_limit method" do
it 'rejects body more than 1 megabyte by default' do it 'rejects body more than 1 megabyte by default' do
stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes)) stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes))
expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
end end
it 'accepts body less than 1 megabyte by default' do it 'accepts body less than 1 megabyte by default' do
stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes)) stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.kilobytes))
expect { subject.perform { |response| response.body_with_limit } }.to_not raise_error expect { subject.perform(&:body_with_limit) }.to_not raise_error
end end
it 'rejects body by given size' do it 'rejects body by given size' do
@ -112,12 +112,12 @@ describe Request do
it 'rejects too large chunked body' do it 'rejects too large chunked body' do
stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Transfer-Encoding' => 'chunked' }) stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Transfer-Encoding' => 'chunked' })
expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
end end
it 'rejects too large monolithic body' do it 'rejects too large monolithic body' do
stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Content-Length' => 2.megabytes }) stub_request(:any, 'http://example.com').to_return(body: SecureRandom.random_bytes(2.megabytes), headers: { 'Content-Length' => 2.megabytes })
expect { subject.perform { |response| response.body_with_limit } }.to raise_error Mastodon::LengthValidationError expect { subject.perform(&:body_with_limit) }.to raise_error Mastodon::LengthValidationError
end end
it 'truncates large monolithic body' do it 'truncates large monolithic body' do