Skip to content

Commit

Permalink
Autofix Rubocop Style/SymbolProc (mastodon#23742)
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni authored and skerit committed Jul 7, 2023
1 parent 4ef5d56 commit 6d9e889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2451,11 +2451,3 @@ Style/SymbolArray:
- 'spec/controllers/concerns/signature_verification_spec.rb'
- 'spec/fabricators/notification_fabricator.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'
8 changes: 4 additions & 4 deletions spec/lib/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@
describe "response's body_with_limit method" 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))
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

it 'accepts body less than 1 megabyte by default' do
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

it 'rejects body by given size' do
Expand All @@ -112,12 +112,12 @@

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' })
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

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 })
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

it 'truncates large monolithic body' do
Expand Down

0 comments on commit 6d9e889

Please sign in to comment.