Fix all Rails/DynamicFindBy rubocop issues
This commit is contained in:
@@ -365,16 +365,6 @@ Performance/RedundantMatch:
|
||||
- 'app/controllers/valuation/spending_proposals_controller.rb'
|
||||
- 'app/helpers/embed_videos_helper.rb'
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Whitelist.
|
||||
# Whitelist: find_by_sql
|
||||
Rails/DynamicFindBy:
|
||||
Exclude:
|
||||
- 'app/controllers/users/confirmations_controller.rb'
|
||||
- 'app/controllers/users/registrations_controller.rb'
|
||||
- 'spec/features/management/users_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Rails/FilePath:
|
||||
Exclude:
|
||||
|
||||
@@ -3,7 +3,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
# new action, PATCH does not exist in the default Devise::ConfirmationsController
|
||||
# PATCH /resource/confirmation
|
||||
def update
|
||||
self.resource = resource_class.find_by_confirmation_token(params[:confirmation_token])
|
||||
self.resource = resource_class.find_by(confirmation_token: params[:confirmation_token])
|
||||
|
||||
if resource.encrypted_password.blank?
|
||||
resource.assign_attributes(resource_params)
|
||||
@@ -27,7 +27,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
def show
|
||||
# In the default implementation, this already confirms the resource:
|
||||
# self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
||||
self.resource = resource_class.find_by_confirmation_token(params[:confirmation_token])
|
||||
self.resource = resource_class.find_by(confirmation_token: params[:confirmation_token])
|
||||
|
||||
yield resource if block_given?
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
||||
end
|
||||
|
||||
def check_username
|
||||
if User.find_by_username params[:username]
|
||||
if User.find_by username: params[:username]
|
||||
render json: {available: false, message: t("devise_views.users.registrations.new.username_is_not_available")}
|
||||
else
|
||||
render json: {available: true, message: t("devise_views.users.registrations.new.username_is_available")}
|
||||
|
||||
@@ -24,7 +24,7 @@ feature 'Users' do
|
||||
expect(page).to have_content "We have sent an email"
|
||||
expect(page).to_not have_content "Autogenerated password is"
|
||||
|
||||
user = User.find_by_email('pepe@gmail.com')
|
||||
user = User.find_by(email: 'pepe@gmail.com')
|
||||
|
||||
expect(user).to be_level_three_verified
|
||||
expect(user).to be_residence_verified
|
||||
@@ -64,7 +64,7 @@ feature 'Users' do
|
||||
expect(page).to_not have_content "We have sent an email"
|
||||
expect(page).to have_content "Autogenerated password is"
|
||||
|
||||
user = User.find_by_username('Kelly Sue')
|
||||
user = User.find_by(username: 'Kelly Sue')
|
||||
|
||||
expect(user).to be_level_three_verified
|
||||
expect(user).to be_residence_verified
|
||||
|
||||
Reference in New Issue
Block a user