Sha256: 44e1f8be04d0abb55f6cb7115f99e8884e5601bfbcc9dda71479575589f5591c
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require "test_helper" class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTest setup do @user = sign_in_as(users(:lazaro_nixon)) @sid = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 20.minutes) @sid_exp = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 0.minutes) @user.update! verified: false end test "should send a verification email" do assert_enqueued_email_with UserMailer, :email_confirmation, args: { user: @user } do post identity_email_verification_url end assert_redirected_to root_url end test "should verify email" do get edit_identity_email_verification_url(token: @sid, email: @user.email) assert_redirected_to root_url end test "should not verify email with expired token" do get edit_identity_email_verification_url(token: @sid_exp, email: @user.email) assert_redirected_to edit_identity_email_url assert_equal "That email verification link is invalid", flash[:alert] end test "should not verify email with previous token" do @user.update! email: "other_email@hey.com" get edit_identity_email_verification_url(token: @sid, email: @user.email_previously_was) assert_redirected_to edit_identity_email_url assert_equal "That email verification link is invalid", flash[:alert] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authentication-zero-2.12.5 | lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt |