mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-08 22:37:57 -05:00
Replace usage of assert ! with actual assert_not helper
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user