0
0
Fork 0

Enable Rubocop HTTP status rules (#23717)

This commit is contained in:
Nick Schonning 2023-02-19 21:16:40 -05:00 committed by GitHub
parent bd1d57c230
commit aef0051fd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 77 additions and 242 deletions

View file

@ -83,7 +83,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Admin') }
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(account.reload).to_not be_memorial
end
end
@ -105,7 +105,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Admin') }
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(account.reload).to_not be_memorial
end
end
@ -114,7 +114,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Moderator') }
it 'fails to memorialize account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(account.reload).to_not be_memorial
end
end
@ -141,7 +141,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone }
it 'fails to enable account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(user.reload).to be_disabled
end
end
@ -167,7 +167,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
end
it 'logs action' do
is_expected.to have_http_status :found
is_expected.to have_http_status 302
log_item = Admin::ActionLog.last
@ -182,7 +182,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone }
it 'fails to approve account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(user.reload).to_not be_approved
end
end
@ -207,7 +207,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
end
it 'logs action' do
is_expected.to have_http_status :found
is_expected.to have_http_status 302
log_item = Admin::ActionLog.last
@ -222,7 +222,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone }
it 'fails to reject account' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
expect(user.reload).to_not be_approved
end
end
@ -250,7 +250,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone }
it 'fails to redownload' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
end
end
end
@ -273,7 +273,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.everyone }
it 'fails to remove avatar' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
end
end
end
@ -303,7 +303,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
it 'fails to remove avatar' do
subject
expect(response).to have_http_status :forbidden
expect(response).to have_http_status 403
end
end
end

View file

@ -15,7 +15,7 @@ describe Admin::BaseController, type: :controller do
sign_in(Fabricate(:user))
get :success
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
it 'renders admin layout as a moderator' do

View file

@ -50,7 +50,7 @@ RSpec.describe Admin::InstancesController, type: :controller do
let(:role) { nil }
it 'fails to purge instance' do
is_expected.to have_http_status :forbidden
is_expected.to have_http_status 403
end
end
end

View file

@ -18,7 +18,7 @@ describe Admin::RolesController do
context 'when user does not have permission to manage roles' do
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
@ -38,7 +38,7 @@ describe Admin::RolesController do
context 'when user does not have permission to manage roles' do
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
@ -128,7 +128,7 @@ describe Admin::RolesController do
context 'when user does not have permission to manage roles' do
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
@ -145,7 +145,7 @@ describe Admin::RolesController do
let(:role_position) { current_role.position + 1 }
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
end
@ -165,7 +165,7 @@ describe Admin::RolesController do
context 'when user does not have permission to manage roles' do
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
it 'does not update the role' do
@ -203,7 +203,7 @@ describe Admin::RolesController do
let(:role_position) { current_role.position + 1 }
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
it 'does not update the role' do
@ -224,7 +224,7 @@ describe Admin::RolesController do
context 'when user does not have permission to manage roles' do
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
@ -241,7 +241,7 @@ describe Admin::RolesController do
let(:role_position) { current_role.position + 1 }
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
end

View file

@ -26,7 +26,7 @@ describe Admin::Users::RolesController do
let(:previous_role) { UserRole.create(name: 'Baz', permissions: UserRole::FLAGS[:administrator], position: 100) }
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
end
@ -74,7 +74,7 @@ describe Admin::Users::RolesController do
end
it 'returns http forbidden' do
expect(response).to have_http_status(:forbidden)
expect(response).to have_http_status(403)
end
end
end