From 890bd9e3b58dd321eb4a2f3670eb2f54d8e996ed Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 2 Mar 2023 18:41:44 -0300 Subject: [PATCH] Replace usage of `assert !` with actual `assert_not` helper --- test/integration/authenticatable_test.rb | 2 +- test/integration/omniauthable_test.rb | 4 ++-- test/integration/recoverable_test.rb | 10 +++++----- test/models/confirmable_test.rb | 6 +++--- test/models/database_authenticatable_test.rb | 6 +++--- test/models/lockable_test.rb | 2 +- test/models/serializable_test.rb | 2 +- test/test/controller_helpers_test.rb | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index a8592e14..b8d1be8e 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -397,7 +397,7 @@ class AuthenticationWithScopedViewsTest < Devise::IntegrationTest end assert_match %r{Special user view}, response.body - assert !Devise::PasswordsController.scoped_views? + assert_not Devise::PasswordsController.scoped_views? ensure Devise::SessionsController.send :remove_instance_variable, :@scoped_views end diff --git a/test/integration/omniauthable_test.rb b/test/integration/omniauthable_test.rb index 61d6dab2..db3d0871 100644 --- a/test/integration/omniauthable_test.rb +++ b/test/integration/omniauthable_test.rb @@ -98,7 +98,7 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest assert session["devise.facebook_data"] visit "/users/cancel" - assert !session["devise.facebook_data"] + assert_not session["devise.facebook_data"] end test "cleans up session on sign in" do @@ -109,7 +109,7 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest assert session["devise.facebook_data"] sign_in_as_user - assert !session["devise.facebook_data"] + assert_not session["devise.facebook_data"] end test "sign in and send remember token if configured" do diff --git a/test/integration/recoverable_test.rb b/test/integration/recoverable_test.rb index 57bfb9f7..9abf2b1b 100644 --- a/test/integration/recoverable_test.rb +++ b/test/integration/recoverable_test.rb @@ -218,7 +218,7 @@ class PasswordTest < Devise::IntegrationTest assert_contain 'Your password has been changed successfully.' assert_not_contain 'You are now signed in.' assert_equal new_user_session_path, @request.path - assert !warden.authenticated?(:user) + assert_not warden.authenticated?(:user) end end @@ -231,7 +231,7 @@ class PasswordTest < Devise::IntegrationTest assert_contain 'Your password has been changed successfully' assert_not_contain 'You are now signed in.' assert_equal new_user_session_path, @request.path - assert !warden.authenticated?(:user) + assert_not warden.authenticated?(:user) end end @@ -257,7 +257,7 @@ class PasswordTest < Devise::IntegrationTest assert_contain 'Your password has been changed successfully.' assert_not_contain 'You are now signed in.' assert_equal new_user_session_path, @request.path - assert !warden.authenticated?(:user) + assert_not warden.authenticated?(:user) end end end @@ -269,7 +269,7 @@ class PasswordTest < Devise::IntegrationTest reset_password assert_contain 'Your password has been changed successfully.' - assert !user.reload.access_locked? + assert_not user.reload.access_locked? assert warden.authenticated?(:user) end end @@ -281,7 +281,7 @@ class PasswordTest < Devise::IntegrationTest reset_password assert_contain 'Your password has been changed successfully.' - assert !user.reload.access_locked? + assert_not user.reload.access_locked? assert warden.authenticated?(:user) end end diff --git a/test/models/confirmable_test.rb b/test/models/confirmable_test.rb index 7343843a..9c627e82 100644 --- a/test/models/confirmable_test.rb +++ b/test/models/confirmable_test.rb @@ -538,7 +538,7 @@ class ReconfirmableTest < ActiveSupport::TestCase test 'should not require reconfirmation after creating a record' do admin = create_admin - assert !admin.pending_reconfirmation? + assert_not admin.pending_reconfirmation? end test 'should not require reconfirmation after creating a record with #save called in callback' do @@ -547,12 +547,12 @@ class ReconfirmableTest < ActiveSupport::TestCase end admin = Admin::WithSaveInCallback.create(valid_attributes.except(:username)) - assert !admin.pending_reconfirmation? + assert_not admin.pending_reconfirmation? end test 'should require reconfirmation after creating a record and updating the email' do admin = create_admin - assert !admin.instance_variable_get(:@bypass_confirmation_postpone) + assert_not admin.instance_variable_get(:@bypass_confirmation_postpone) admin.email = "new_test@email.com" admin.save assert admin.pending_reconfirmation? diff --git a/test/models/database_authenticatable_test.rb b/test/models/database_authenticatable_test.rb index a41659d6..8cdf7228 100644 --- a/test/models/database_authenticatable_test.rb +++ b/test/models/database_authenticatable_test.rb @@ -214,14 +214,14 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase test 'should not update password without password' do user = create_user user.update_without_password(password: 'pass4321', password_confirmation: 'pass4321') - assert !user.reload.valid_password?('pass4321') + assert_not user.reload.valid_password?('pass4321') assert user.valid_password?('12345678') end test 'should destroy user if current password is valid' do user = create_user assert user.destroy_with_password('12345678') - assert !user.persisted? + assert_not user.persisted? end test 'should not destroy user with invalid password' do @@ -289,7 +289,7 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase test 'downcase_keys with validation' do User.create(email: "HEllO@example.com", password: "123456") user = User.create(email: "HEllO@example.com", password: "123456") - assert !user.valid? + assert_not user.valid? end test 'required_fields should be encryptable_password and the email field by default' do diff --git a/test/models/lockable_test.rb b/test/models/lockable_test.rb index d7d14b6a..d229ce57 100644 --- a/test/models/lockable_test.rb +++ b/test/models/lockable_test.rb @@ -34,7 +34,7 @@ class LockableTest < ActiveSupport::TestCase user.confirm swap Devise, lock_strategy: :none, maximum_attempts: 2 do 3.times { user.valid_for_authentication?{ false } } - assert !user.access_locked? + assert_not user.access_locked? assert_equal 0, user.failed_attempts end end diff --git a/test/models/serializable_test.rb b/test/models/serializable_test.rb index 53f0f59f..225f7ae6 100644 --- a/test/models/serializable_test.rb +++ b/test/models/serializable_test.rb @@ -40,7 +40,7 @@ class SerializableTest < ActiveSupport::TestCase end def assert_no_key(key, subject) - assert !subject.key?(key), "Expected #{subject.inspect} to not have key #{key.inspect}" + assert_not subject.key?(key), "Expected #{subject.inspect} to not have key #{key.inspect}" end def from_json(options = nil) diff --git a/test/test/controller_helpers_test.rb b/test/test/controller_helpers_test.rb index c93ecf2e..d415a176 100644 --- a/test/test/controller_helpers_test.rb +++ b/test/test/controller_helpers_test.rb @@ -15,7 +15,7 @@ class TestControllerHelpersTest < Devise::ControllerTestCase test "redirects if attempting to access a page with an unconfirmed account" do swap Devise, allow_unconfirmed_access_for: 0.days do user = create_user - assert !user.active_for_authentication? + assert_not user.active_for_authentication? sign_in user get :index @@ -26,7 +26,7 @@ class TestControllerHelpersTest < Devise::ControllerTestCase test "returns nil if accessing current_user with an unconfirmed account" do swap Devise, allow_unconfirmed_access_for: 0.days do user = create_user - assert !user.active_for_authentication? + assert_not user.active_for_authentication? sign_in user get :accept, params: { id: user }