0
0
Fork 0

Fix Lint/ConstantDefinitionInBlock cop (#24763)

This commit is contained in:
Matt Jankowski 2023-05-03 04:32:30 -04:00 committed by GitHub
parent 8b636a29c6
commit 3df665fd23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 120 additions and 118 deletions

View file

@ -74,7 +74,11 @@ describe Api::BaseController do
end
describe 'error handling' do
ERRORS_WITH_CODES = {
before do
routes.draw { get 'error' => 'api/base#error' }
end
{
ActiveRecord::RecordInvalid => 422,
Mastodon::ValidationError => 422,
ActiveRecord::RecordNotFound => 404,
@ -82,13 +86,7 @@ describe Api::BaseController do
HTTP::Error => 503,
OpenSSL::SSL::SSLError => 503,
Mastodon::NotPermittedError => 403,
}
before do
routes.draw { get 'error' => 'api/base#error' }
end
ERRORS_WITH_CODES.each do |error, code|
}.each do |error, code|
it "Handles error class of #{error}" do
expect(FakeService).to receive(:new).and_raise(error)