0
0
Fork 0

Autofix Rubocop RSpec/ImplicitSubject (#23721)

This commit is contained in:
Nick Schonning 2023-02-19 23:00:48 -05:00 committed by GitHub
parent 63e6353886
commit 38a1d8bb85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 184 additions and 221 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 403
expect(subject).to have_http_status 403
expect(account.reload).to_not be_memorial
end
end
@ -92,7 +92,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:target_role) { UserRole.find_by(name: 'Moderator') }
it 'succeeds in memorializing account' do
is_expected.to redirect_to admin_account_path(account.id)
expect(subject).to redirect_to admin_account_path(account.id)
expect(account.reload).to 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 403
expect(subject).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 403
expect(subject).to have_http_status 403
expect(account.reload).to_not be_memorial
end
end
@ -132,7 +132,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in enabling account' do
is_expected.to redirect_to admin_account_path(account.id)
expect(subject).to redirect_to admin_account_path(account.id)
expect(user.reload).to_not be_disabled
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 403
expect(subject).to have_http_status 403
expect(user.reload).to be_disabled
end
end
@ -162,12 +162,12 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in approving account' do
is_expected.to redirect_to admin_accounts_path(status: 'pending')
expect(subject).to redirect_to admin_accounts_path(status: 'pending')
expect(user.reload).to be_approved
end
it 'logs action' do
is_expected.to have_http_status 302
expect(subject).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 403
expect(subject).to have_http_status 403
expect(user.reload).to_not be_approved
end
end
@ -203,11 +203,11 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in rejecting account' do
is_expected.to redirect_to admin_accounts_path(status: 'pending')
expect(subject).to redirect_to admin_accounts_path(status: 'pending')
end
it 'logs action' do
is_expected.to have_http_status 302
expect(subject).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 403
expect(subject).to have_http_status 403
expect(user.reload).to_not be_approved
end
end
@ -242,7 +242,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in redownloading' do
is_expected.to redirect_to admin_account_path(account.id)
expect(subject).to redirect_to admin_account_path(account.id)
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 403
expect(subject).to have_http_status 403
end
end
end
@ -265,7 +265,7 @@ RSpec.describe Admin::AccountsController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in removing avatar' do
is_expected.to redirect_to admin_account_path(account.id)
expect(subject).to redirect_to admin_account_path(account.id)
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 403
expect(subject).to have_http_status 403
end
end
end

View file

@ -42,7 +42,7 @@ RSpec.describe Admin::InstancesController, type: :controller do
let(:role) { UserRole.find_by(name: 'Admin') }
it 'succeeds in purging instance' do
is_expected.to redirect_to admin_instances_path
expect(subject).to redirect_to admin_instances_path
end
end
@ -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 403
expect(subject).to have_http_status 403
end
end
end

View file

@ -28,7 +28,7 @@ describe ApplicationController, type: :controller do
end
it 'renders template for http' do
is_expected.to render_template("errors/#{code}", layout: 'error')
expect(subject).to render_template("errors/#{code}", layout: 'error')
end
end

View file

@ -9,7 +9,7 @@ RSpec.describe HomeController, type: :controller do
context 'when not signed in' do
it 'returns http success' do
@request.path = '/'
is_expected.to have_http_status(:success)
expect(subject).to have_http_status(:success)
end
end
@ -21,7 +21,7 @@ RSpec.describe HomeController, type: :controller do
end
it 'returns http success' do
is_expected.to have_http_status(:success)
expect(subject).to have_http_status(:success)
end
end
end

View file

@ -7,7 +7,7 @@ describe RelationshipsController do
shared_examples 'authenticate user' do
it 'redirects when not signed in' do
is_expected.to redirect_to '/auth/sign_in'
expect(subject).to redirect_to '/auth/sign_in'
end
end

View file

@ -5,7 +5,7 @@ describe Settings::FeaturedTagsController do
shared_examples 'authenticate user' do
it 'redirects to sign_in page' do
is_expected.to redirect_to new_user_session_path
expect(subject).to redirect_to new_user_session_path
end
end

View file

@ -5,7 +5,7 @@ describe Settings::MigrationsController do
shared_examples 'authenticate user' do
it 'redirects to sign_in page' do
is_expected.to redirect_to new_user_session_path
expect(subject).to redirect_to new_user_session_path
end
end
@ -27,8 +27,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { nil }
it 'renders show page' do
is_expected.to have_http_status 200
is_expected.to render_template :show
expect(subject).to have_http_status 200
expect(subject).to render_template :show
end
end
@ -36,8 +36,8 @@ describe Settings::MigrationsController do
let(:moved_to_account) { Fabricate(:account) }
it 'renders show page' do
is_expected.to have_http_status 200
is_expected.to render_template :show
expect(subject).to have_http_status 200
expect(subject).to render_template :show
end
end
end
@ -61,7 +61,7 @@ describe Settings::MigrationsController do
let(:acct) { Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(user.account)]) }
it 'updates moved to account' do
is_expected.to redirect_to settings_migration_path
expect(subject).to redirect_to settings_migration_path
expect(user.account.reload.moved_to_account_id).to eq acct.id
end
end
@ -70,7 +70,7 @@ describe Settings::MigrationsController do
let(:acct) { user.account }
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do
@ -82,7 +82,7 @@ describe Settings::MigrationsController do
let(:acct) { Fabricate(:account, also_known_as: []) }
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do
@ -99,7 +99,7 @@ describe Settings::MigrationsController do
end
it 'renders show' do
is_expected.to render_template :show
expect(subject).to render_template :show
end
it 'does not update the moved account' do

View file

@ -15,7 +15,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id }
it 'destroys session activation' do
is_expected.to redirect_to edit_user_registration_path
expect(subject).to redirect_to edit_user_registration_path
expect(SessionActivation.find_by(id: id)).to be_nil
end
end
@ -24,7 +24,7 @@ describe Settings::SessionsController do
let(:id) { session_activation.id + 1000 }
it 'destroys session activation' do
is_expected.to have_http_status 404
expect(subject).to have_http_status 404
end
end
end