Fix Lint/ConstantDefinitionInBlock cop (#24763)
This commit is contained in:
parent
8b636a29c6
commit
3df665fd23
9 changed files with 120 additions and 118 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue