153b48f9f9
Previously the user could not delete his own account unless signup was enabled in the global settings. This was due to the fact that deleting the user would also delete the issues and other items associated to him. Deleting an user does not destroy essential data anymore, for this reason we removed the `signup_enabled?` check.
80 lines
1.8 KiB
Ruby
80 lines
1.8 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe 'Profile account page' do
|
|
let(:user) { create(:user) }
|
|
|
|
before do
|
|
sign_in(user)
|
|
end
|
|
|
|
describe 'when I delete my account' do
|
|
before do
|
|
visit profile_account_path
|
|
end
|
|
|
|
it { expect(page).to have_content('Remove account') }
|
|
|
|
it 'deletes the account' do
|
|
expect { click_link 'Delete account' }.to change { User.where(id: user.id).count }.by(-1)
|
|
expect(current_path).to eq(new_user_session_path)
|
|
end
|
|
end
|
|
|
|
describe 'when I reset private token' do
|
|
before do
|
|
visit profile_account_path
|
|
end
|
|
|
|
it 'resets private token' do
|
|
previous_token = find("#private-token").value
|
|
|
|
click_link('Reset private token')
|
|
|
|
expect(find('#private-token').value).not_to eq(previous_token)
|
|
end
|
|
end
|
|
|
|
describe 'when I reset RSS token' do
|
|
before do
|
|
visit profile_account_path
|
|
end
|
|
|
|
it 'resets RSS token' do
|
|
previous_token = find("#rss-token").value
|
|
|
|
click_link('Reset RSS token')
|
|
|
|
expect(page).to have_content 'RSS token was successfully reset'
|
|
expect(find('#rss-token').value).not_to eq(previous_token)
|
|
end
|
|
end
|
|
|
|
describe 'when I reset incoming email token' do
|
|
before do
|
|
allow(Gitlab.config.incoming_email).to receive(:enabled).and_return(true)
|
|
visit profile_account_path
|
|
end
|
|
|
|
it 'resets incoming email token' do
|
|
previous_token = find('#incoming-email-token').value
|
|
|
|
click_link('Reset incoming email token')
|
|
|
|
expect(find('#incoming-email-token').value).not_to eq(previous_token)
|
|
end
|
|
end
|
|
|
|
describe 'when I change my username' do
|
|
before do
|
|
visit profile_account_path
|
|
end
|
|
|
|
it 'changes my username' do
|
|
fill_in 'user_username', with: 'new-username'
|
|
|
|
click_button('Update username')
|
|
|
|
expect(page).to have_content('new-username')
|
|
end
|
|
end
|
|
end
|