From 8e238f42732e5968dc46e3f08d853d0f3c9b2760 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 4 Sep 2013 16:20:40 +0300 Subject: [PATCH] Fix user remove tests. Remove user even if he has projects --- app/controllers/registrations_controller.rb | 3 --- spec/features/profile_spec.rb | 16 +--------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 194dfcd..5f18bac 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -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| diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 7fa474d..80c9f5d 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -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) -- libgit2 0.21.2