Sha256: 56d9c973e60ca00453c55a02241e02230ed2328caa2a5abdf6a2363e32765b94

Contents?: true

Size: 1013 Bytes

Versions: 12

Compression:

Stored size: 1013 Bytes

Contents

require "test_helper"

class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @user = sign_in_as(users(:lazaro_nixon))
    @user.update! verified: false
  end

  test "should send a verification email" do
    assert_enqueued_email_with UserMailer, :email_verification, args: { user: @user } do
      post identity_email_verification_url
    end

    assert_redirected_to root_url
  end

  test "should verify email" do
    sid = @user.email_verification_tokens.create.signed_id(expires_in: 2.days)

    get edit_identity_email_verification_url(sid: sid, email: @user.email)
    assert_redirected_to root_url
  end

  test "should not verify email with expired token" do
    sid_exp = @user.email_verification_tokens.create.signed_id(expires_in: 0.minutes)

    get edit_identity_email_verification_url(sid: sid_exp, email: @user.email)

    assert_redirected_to edit_identity_email_url
    assert_equal "That email verification link is invalid", flash[:alert]
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
authentication-zero-2.16.7 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.6 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.5 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.4 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.3 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.2 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.1 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.16.0 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.15.9 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.15.8 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.15.7 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt
authentication-zero-2.15.6 lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt