-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add invalid token flow with feature specs
- Loading branch information
Showing
10 changed files
with
115 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<%= content_for :breadcrumbs do %> | ||
<%= breadcrumbs @user %> | ||
<% end %> | ||
|
||
<div class="row"> | ||
<div class="mu-inline-block-left"> | ||
<h1> | ||
<%= t :delete_account %> | ||
</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-md-12"> | ||
<p> | ||
Lo sentimos, el enlace que te trajo hasta aquí ha expirado o es inválido. | ||
<%= t :delete_account_invalid_token %> | ||
</p> | ||
<p> | ||
Si todavía querés eliminar tu cuenta, volvé a iniciar el proceso desde <%= link_to 'tu perfil', user_path %>. | ||
<%= t :delete_account_try_again_html, profile_url: user_path %> | ||
</p> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Delete account Flow', organization_workspace: :test, requires_js: true do | ||
before { set_current_user! user } | ||
|
||
def accept_delete_confirmation_modal! | ||
within '#user-delete-account-modal' do | ||
fill_in 'confirm-delete-input', with: 'delete my account' | ||
click_on 'delete-account-button' | ||
end | ||
end | ||
|
||
context 'Step 1: delete request' do | ||
let(:user) { create(:user, email: 'pirulo@mail.com') } | ||
|
||
before do | ||
visit user_path | ||
click_on 'Delete account' | ||
accept_delete_confirmation_modal! | ||
end | ||
|
||
context 'redirects to confirmation view' do | ||
it { expect(page).to have_text 'We sent you an email to pirulo@mail.com' } | ||
end | ||
end | ||
|
||
context 'Step 2: delete confirmation' do | ||
let(:expiration_date) { 2.days.from_now } | ||
let(:user) { create(:user, delete_account_token: 'abc1234', delete_account_token_expiration_date: expiration_date) } | ||
|
||
before { visit delete_confirmation_user_path token: token } | ||
|
||
context 'with valid token' do | ||
let(:token) { 'abc1234' } | ||
before { accept_delete_confirmation_modal! } | ||
it { expect(page).to have_text 'You are not allowed to see this content' } | ||
end | ||
|
||
context 'with invalid token' do | ||
let(:token) { 'faketoken' } | ||
it { expect(page).to have_text 'We are sorry, the link has expired or is invalid' } | ||
end | ||
|
||
context 'with expired token' do | ||
let(:token) { 'abc1234' } | ||
let(:expiration_date) { 1.hour.ago } | ||
it { expect(page).to have_text 'We are sorry, the link has expired or is invalid' } | ||
end | ||
end | ||
end |