Enable Rubocop HTTP status rules (#23717)
This commit is contained in:
parent
bd1d57c230
commit
aef0051fd0
32 changed files with 77 additions and 242 deletions
|
@ -78,7 +78,7 @@ describe Api::V1::Accounts::CredentialsController do
|
|||
end
|
||||
|
||||
it 'returns http unprocessable entity' do
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(response).to have_http_status(422)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -92,14 +92,14 @@ describe Api::V1::Accounts::CredentialsController do
|
|||
describe 'GET #show' do
|
||||
it 'returns http unauthorized' do
|
||||
get :show
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
expect(response).to have_http_status(401)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PATCH #update' do
|
||||
it 'returns http unauthorized' do
|
||||
patch :update, params: { note: 'Foo' }
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
expect(response).to have_http_status(401)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe Api::V1::Accounts::StatusesController do
|
|||
it 'returns http success' do
|
||||
get :index, params: { account_id: user.account.id, limit: 1 }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns expected headers' do
|
||||
|
@ -29,7 +29,7 @@ describe Api::V1::Accounts::StatusesController do
|
|||
it 'returns http success' do
|
||||
get :index, params: { account_id: user.account.id, only_media: true }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -44,7 +44,7 @@ describe Api::V1::Accounts::StatusesController do
|
|||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns posts along with self replies' do
|
||||
|
@ -63,7 +63,7 @@ describe Api::V1::Accounts::StatusesController do
|
|||
it 'returns http success' do
|
||||
get :index, params: { account_id: user.account.id, pinned: true }
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ describe Api::V1::Accounts::StatusesController do
|
|||
|
||||
it 'returns http success' do
|
||||
get :index, params: { account_id: account.id, pinned: true }
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
context 'when user does not follow account' do
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe Api::V1::Announcements::ReactionsController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unauthorized' do
|
||||
put :update, params: { announcement_id: announcement.id, id: '😂' }
|
||||
expect(response).to have_http_status :unauthorized
|
||||
expect(response).to have_http_status 401
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ RSpec.describe Api::V1::Announcements::ReactionsController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unauthorized' do
|
||||
delete :destroy, params: { announcement_id: announcement.id, id: '😂' }
|
||||
expect(response).to have_http_status :unauthorized
|
||||
expect(response).to have_http_status 401
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ RSpec.describe Api::V1::AnnouncementsController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unprocessable entity' do
|
||||
get :index
|
||||
expect(response).to have_http_status :unprocessable_entity
|
||||
expect(response).to have_http_status 422
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ RSpec.describe Api::V1::AnnouncementsController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unauthorized' do
|
||||
post :dismiss, params: { id: announcement.id }
|
||||
expect(response).to have_http_status :unauthorized
|
||||
expect(response).to have_http_status 401
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ describe Api::V1::Apps::CredentialsController do
|
|||
describe 'GET #show' do
|
||||
it 'returns http unauthorized' do
|
||||
get :show
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
expect(response).to have_http_status(401)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unauthorized' do
|
||||
get :index
|
||||
expect(response).to have_http_status :unauthorized
|
||||
expect(response).to have_http_status 401
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
|
|||
|
||||
it 'returns http forbidden' do
|
||||
get :index
|
||||
expect(response).to have_http_status :forbidden
|
||||
expect(response).to have_http_status 403
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
|
|||
|
||||
it 'returns http unprocessable entity' do
|
||||
get :index
|
||||
expect(response).to have_http_status :unprocessable_entity
|
||||
expect(response).to have_http_status 422
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
|||
context 'from a random app' do
|
||||
it 'returns http forbidden' do
|
||||
post :create
|
||||
expect(response).to have_http_status(:forbidden)
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
|||
|
||||
it 'returns http forbidden' do
|
||||
post :create
|
||||
expect(response).to have_http_status(:forbidden)
|
||||
expect(response).to have_http_status(403)
|
||||
end
|
||||
|
||||
context 'but user changed e-mail and has not confirmed it' do
|
||||
|
@ -57,7 +57,7 @@ RSpec.describe Api::V1::Emails::ConfirmationsController, type: :controller do
|
|||
context 'without an oauth token' do
|
||||
it 'returns http unauthorized' do
|
||||
post :create
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
expect(response).to have_http_status(401)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
|
|||
context 'without token' do
|
||||
it 'returns http unauthorized' do
|
||||
get :index
|
||||
expect(response).to have_http_status :unauthorized
|
||||
expect(response).to have_http_status 401
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
|
|||
|
||||
it 'returns http forbidden' do
|
||||
get :index
|
||||
expect(response).to have_http_status :forbidden
|
||||
expect(response).to have_http_status 403
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
|
|||
|
||||
it 'returns http unprocessable entity' do
|
||||
get :index
|
||||
expect(response).to have_http_status :unprocessable_entity
|
||||
expect(response).to have_http_status 422
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
end
|
||||
|
||||
it 'returns http 422' do
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(response).to have_http_status(422)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -106,7 +106,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
|
||||
it 'returns http not found' do
|
||||
put :update, params: { id: media.id, description: 'Lorem ipsum!!!' }
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -126,7 +126,7 @@ RSpec.describe Api::V1::MediaController, type: :controller do
|
|||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
it 'returns http not found' do
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ describe Api::V1::Timelines::HomeController do
|
|||
it 'returns http unprocessable entity' do
|
||||
get :show
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.headers['Link']).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ describe Api::V1::Timelines::ListController do
|
|||
describe 'GET #show' do
|
||||
it 'returns http not found' do
|
||||
get :show, params: { id: list.id }
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response).to have_http_status(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ describe Api::V1::Timelines::ListController do
|
|||
it 'returns http unprocessable entity' do
|
||||
get :show, params: { id: list.id }
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
expect(response).to have_http_status(422)
|
||||
expect(response.headers['Link']).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue