Sha256: e6dd7fcb61fb02f70e2fe8c4f2e9c960c6f4d5b03ff175b4e11e08758fa3ea0c
Contents?: true
Size: 1.58 KB
Versions: 5
Compression:
Stored size: 1.58 KB
Contents
require "test_helper" class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %> = sign_in_as(<%= table_name %>(:lazaro_nixon)) @sid = @<%= singular_table_name %>.signed_id(purpose: @<%= singular_table_name %>.email, expires_in: 20.minutes) @sid_exp = @<%= singular_table_name %>.signed_id(purpose: @<%= singular_table_name %>.email, expires_in: 0.minutes) @<%= singular_table_name %>.update! verified: false end test "should send a verification email" do assert_enqueued_email_with IdentityMailer, :email_verify_confirmation, args: { <%= singular_table_name %>: @<%= singular_table_name %> } 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: @<%= singular_table_name %>.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: @<%= singular_table_name %>.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 @<%= singular_table_name %>.update! email: "other_email@hey.com" get edit_identity_email_verification_url(token: @sid, email: @<%= singular_table_name %>.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
5 entries across 5 versions & 1 rubygems