Autofix Rubocop RSpec/BeEq (#23740)

This commit is contained in:
Nick Schonning 2023-02-20 00:14:50 -05:00 committed by GitHub
parent bf785df9fe
commit 5116347eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 139 additions and 182 deletions

View file

@ -25,7 +25,7 @@ RSpec.describe Admin::ExportDomainAllowsController, type: :controller do
expect(response).to redirect_to(admin_instances_path)
# Header should not be imported
expect(DomainAllow.where(domain: '#domain').present?).to eq(false)
expect(DomainAllow.where(domain: '#domain').present?).to be(false)
# Domains should now be added
get :export, params: { format: :csv }

View file

@ -116,7 +116,7 @@ describe Admin::Reports::ActionsController do
it 'marks the non-deleted as sensitive' do
subject
expect(media_attached_status.reload.sensitive).to eq true
expect(media_attached_status.reload.sensitive).to be true
end
end
end

View file

@ -55,7 +55,7 @@ describe Admin::ReportsController do
expect(response).to redirect_to(admin_reports_path)
report.reload
expect(report.action_taken_by_account).to eq user.account
expect(report.action_taken?).to eq true
expect(report.action_taken?).to be true
end
end
@ -66,8 +66,8 @@ describe Admin::ReportsController do
put :reopen, params: { id: report }
expect(response).to redirect_to(admin_report_path(report))
report.reload
expect(report.action_taken_by_account).to eq nil
expect(report.action_taken?).to eq false
expect(report.action_taken_by_account).to be_nil
expect(report.action_taken?).to be false
end
end
@ -89,7 +89,7 @@ describe Admin::ReportsController do
put :unassign, params: { id: report }
expect(response).to redirect_to(admin_report_path(report))
report.reload
expect(report.assigned_account).to eq nil
expect(report.assigned_account).to be_nil
end
end
end

View file

@ -20,7 +20,7 @@ describe Admin::Users::TwoFactorAuthenticationsController do
delete :destroy, params: { user_id: user.id }
user.reload
expect(user.otp_enabled?).to eq false
expect(user.otp_enabled?).to be false
expect(response).to redirect_to(admin_account_path(user.account_id))
end
end
@ -43,8 +43,8 @@ describe Admin::Users::TwoFactorAuthenticationsController do
delete :destroy, params: { user_id: user.id }
user.reload
expect(user.otp_enabled?).to eq false
expect(user.webauthn_enabled?).to eq false
expect(user.otp_enabled?).to be false
expect(user.webauthn_enabled?).to be false
expect(response).to redirect_to(admin_account_path(user.account_id))
end
end

View file

@ -51,7 +51,7 @@ describe Api::V1::Accounts::CredentialsController do
expect(user.account.avatar).to exist
expect(user.account.header).to exist
expect(user.setting_default_privacy).to eq('unlisted')
expect(user.setting_default_sensitive).to eq(true)
expect(user.setting_default_sensitive).to be(true)
end
it 'queues up an account update distribution' do

View file

@ -70,7 +70,7 @@ RSpec.describe Api::V1::BookmarksController, type: :controller do
it 'does not add pagination headers if not necessary' do
get :index
expect(response.headers['Link']).to eq nil
expect(response.headers['Link']).to be_nil
end
end
end

View file

@ -70,7 +70,7 @@ RSpec.describe Api::V1::FavouritesController, type: :controller do
it 'does not add pagination headers if not necessary' do
get :index
expect(response.headers['Link']).to eq nil
expect(response.headers['Link']).to be_nil
end
end
end

View file

@ -45,7 +45,7 @@ RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
it 'returns a keyword' do
json = body_as_json
expect(json[:keyword]).to eq 'magic'
expect(json[:whole_word]).to eq false
expect(json[:whole_word]).to be false
end
it 'creates a keyword' do
@ -78,7 +78,7 @@ RSpec.describe Api::V2::Filters::KeywordsController, type: :controller do
it 'returns expected data' do
json = body_as_json
expect(json[:keyword]).to eq 'foo'
expect(json[:whole_word]).to eq false
expect(json[:whole_word]).to be false
end
context "when trying to access another user's filter keyword" do

View file

@ -57,19 +57,19 @@ describe ApplicationController, type: :controller do
describe 'helper_method :single_user_mode?' do
it 'returns false if it is in single_user_mode but there is no account' do
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(true)
expect(controller.view_context.single_user_mode?).to eq false
expect(controller.view_context.single_user_mode?).to be false
end
it 'returns false if there is an account but it is not in single_user_mode' do
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(false)
Fabricate(:account)
expect(controller.view_context.single_user_mode?).to eq false
expect(controller.view_context.single_user_mode?).to be false
end
it 'returns true if it is in single_user_mode and there is an account' do
allow(Rails.configuration.x).to receive(:single_user_mode).and_return(true)
Fabricate(:account)
expect(controller.view_context.single_user_mode?).to eq true
expect(controller.view_context.single_user_mode?).to be true
end
end

View file

@ -163,7 +163,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
user = User.find_by(email: 'test@example.com')
expect(user).to_not be_nil
expect(user.locale).to eq(accept_language)
expect(user.approved).to eq(false)
expect(user.approved).to be(false)
end
end
@ -191,7 +191,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
user = User.find_by(email: 'test@example.com')
expect(user).to_not be_nil
expect(user.locale).to eq(accept_language)
expect(user.approved).to eq(false)
expect(user.approved).to be(false)
end
end
@ -223,7 +223,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do
user = User.find_by(email: 'test@example.com')
expect(user).to_not be_nil
expect(user.locale).to eq(accept_language)
expect(user.approved).to eq(true)
expect(user.approved).to be(true)
end
end

View file

@ -19,9 +19,9 @@ RSpec.describe StatusesCleanupController, type: :controller do
it 'updates the account status cleanup policy' do
put :update, params: { account_statuses_cleanup_policy: { enabled: true, min_status_age: 2.weeks.seconds, keep_direct: false, keep_polls: true } }
expect(response).to redirect_to(statuses_cleanup_path)
expect(@user.account.statuses_cleanup_policy.enabled).to eq true
expect(@user.account.statuses_cleanup_policy.keep_direct).to eq false
expect(@user.account.statuses_cleanup_policy.keep_polls).to eq true
expect(@user.account.statuses_cleanup_policy.enabled).to be true
expect(@user.account.statuses_cleanup_policy.keep_direct).to be false
expect(@user.account.statuses_cleanup_policy.keep_polls).to be true
end
end
end