Skip to content
Snippets Groups Projects
Commit 17f75e79 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Wes Gurney
Browse files

Fix user remove tests. Remove user even if he has projects

parent 87140808
No related branches found
No related tags found
1 merge request!4954Add support to configure webhook_timeout in gitlab.yaml
Loading
Loading
@@ -2,9 +2,6 @@ class RegistrationsController < Devise::RegistrationsController
before_filter :signup_enabled?
 
def destroy
if current_user.owned_projects.count > 0
redirect_to account_profile_path, alert: "Remove projects and groups before removing account." and return
end
current_user.destroy
 
respond_to do |format|
Loading
Loading
Loading
Loading
@@ -17,26 +17,12 @@ describe "Profile account page" do
 
it { page.should have_content("Remove account") }
 
it "should delete the account", js: true do
it "should delete the account" do
expect { click_link "Delete account" }.to change {User.count}.by(-1)
current_path.should == new_user_session_path
end
end
 
describe "when signup is enabled and user has a project" do
before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
@project = create(:project, namespace: @user.namespace)
@project.team << [@user, :master]
visit account_profile_path
end
it { page.should have_content("Remove account") }
it "should not allow user to delete the account" do
expect { click_link "Delete account" }.not_to change {User.count}.by(-1)
end
end
describe "when signup is disabled" do
before do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment