mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-09 14:58:05 -05:00
Ensure Devise isn't performing model validations
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AuthenticationSanityTest < Devise::IntegrationTest
|
||||
test 'sign in should not run model validations' do
|
||||
sign_in_as_user
|
||||
|
||||
refute User.validations_performed
|
||||
end
|
||||
|
||||
test 'home should be accessible without sign in' do
|
||||
visit '/'
|
||||
assert_response :success
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
require 'test_helper'
|
||||
|
||||
class HttpAuthenticationTest < Devise::IntegrationTest
|
||||
test 'sign in with HTTP should not run model validations' do
|
||||
sign_in_as_new_user_with_http
|
||||
|
||||
refute User.validations_performed
|
||||
end
|
||||
|
||||
test 'handles unverified requests gets rid of caches but continues signed in' do
|
||||
swap ApplicationController, allow_forgery_protection: true do
|
||||
create_user
|
||||
|
||||
@@ -42,6 +42,17 @@ class OmniauthableIntegrationTest < Devise::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test "omniauth sign in should not run model validations" do
|
||||
stub_action!(:sign_in_facebook) do
|
||||
create_user
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
assert warden.authenticated?(:user)
|
||||
|
||||
refute User.validations_performed
|
||||
end
|
||||
end
|
||||
|
||||
test "can access omniauth.auth in the env hash" do
|
||||
visit "/users/sign_in"
|
||||
click_link "Sign in with FaceBook"
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TrackableHooksTest < Devise::IntegrationTest
|
||||
test "trackable should not run model validations" do
|
||||
sign_in_as_user
|
||||
|
||||
refute User.validations_performed
|
||||
end
|
||||
|
||||
test "current and last sign in timestamps are updated on each sign in" do
|
||||
user = create_user
|
||||
|
||||
Reference in New Issue
Block a user