Ensure Devise isn't performing model validations

This commit is contained in:
Leonardo Tegon
2018-03-12 15:57:34 -03:00
parent d870c0dced
commit 5664b19703
8 changed files with 58 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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