Installed authentication-zero
This commit is contained in:
26
test/system/identity/emails_test.rb
Normal file
26
test/system/identity/emails_test.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class Identity::EmailsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@user = sign_in_as(users(:lazaro_nixon))
|
||||
end
|
||||
|
||||
test "updating the email" do
|
||||
click_on "Change email address"
|
||||
|
||||
fill_in "New email", with: "new_email@hey.com"
|
||||
fill_in "Password challenge", with: "Secret1*3*5*"
|
||||
click_on "Save changes"
|
||||
|
||||
assert_text "Your email has been changed"
|
||||
end
|
||||
|
||||
test "sending a verification email" do
|
||||
@user.update! verified: false
|
||||
|
||||
click_on "Change email address"
|
||||
click_on "Re-send verification email"
|
||||
|
||||
assert_text "We sent a verification email to your email address"
|
||||
end
|
||||
end
|
||||
28
test/system/identity/password_resets_test.rb
Normal file
28
test/system/identity/password_resets_test.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class Identity::PasswordResetsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@user = users(:lazaro_nixon)
|
||||
@sid = @user.generate_token_for(:password_reset)
|
||||
end
|
||||
|
||||
test "sending a password reset email" do
|
||||
visit sign_in_url
|
||||
click_on "Forgot your password?"
|
||||
|
||||
fill_in "Email", with: @user.email
|
||||
click_on "Send password reset email"
|
||||
|
||||
assert_text "Check your email for reset instructions"
|
||||
end
|
||||
|
||||
test "updating password" do
|
||||
visit edit_identity_password_reset_url(sid: @sid)
|
||||
|
||||
fill_in "New password", with: "Secret6*4*2*"
|
||||
fill_in "Confirm new password", with: "Secret6*4*2*"
|
||||
click_on "Save changes"
|
||||
|
||||
assert_text "Your password was reset successfully. Please sign in"
|
||||
end
|
||||
end
|
||||
18
test/system/passwords_test.rb
Normal file
18
test/system/passwords_test.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class PasswordsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@user = sign_in_as(users(:lazaro_nixon))
|
||||
end
|
||||
|
||||
test "updating the password" do
|
||||
click_on "Change password"
|
||||
|
||||
fill_in "Password challenge", with: "Secret1*3*5*"
|
||||
fill_in "New password", with: "Secret6*4*2*"
|
||||
fill_in "Confirm new password", with: "Secret6*4*2*"
|
||||
click_on "Save changes"
|
||||
|
||||
assert_text "Your password has been changed"
|
||||
end
|
||||
end
|
||||
14
test/system/registrations_test.rb
Normal file
14
test/system/registrations_test.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class RegistrationsTest < ApplicationSystemTestCase
|
||||
test "signing up" do
|
||||
visit sign_up_url
|
||||
|
||||
fill_in "Email", with: "lazaronixon@hey.com"
|
||||
fill_in "Password", with: "Secret6*4*2*"
|
||||
fill_in "Password confirmation", with: "Secret6*4*2*"
|
||||
click_on "Sign up"
|
||||
|
||||
assert_text "Welcome! You have signed up successfully"
|
||||
end
|
||||
end
|
||||
30
test/system/sessions_test.rb
Normal file
30
test/system/sessions_test.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class SessionsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@user = users(:lazaro_nixon)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
sign_in_as @user
|
||||
|
||||
click_on "Devices & Sessions"
|
||||
assert_selector "h1", text: "Sessions"
|
||||
end
|
||||
|
||||
test "signing in" do
|
||||
visit sign_in_url
|
||||
fill_in "Email", with: @user.email
|
||||
fill_in "Password", with: "Secret1*3*5*"
|
||||
click_on "Sign in"
|
||||
|
||||
assert_text "Signed in successfully"
|
||||
end
|
||||
|
||||
test "signing out" do
|
||||
sign_in_as @user
|
||||
|
||||
click_on "Log out"
|
||||
assert_text "That session has been logged out"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user