Commit 8e238f42732e5968dc46e3f08d853d0f3c9b2760
1 parent
7b8bd93e
Exists in
master
and in
4 other branches
Fix user remove tests. Remove user even if he has projects
Showing
2 changed files
with
1 additions
and
18 deletions
Show diff stats
app/controllers/registrations_controller.rb
... | ... | @@ -2,9 +2,6 @@ class RegistrationsController < Devise::RegistrationsController |
2 | 2 | before_filter :signup_enabled? |
3 | 3 | |
4 | 4 | def destroy |
5 | - if current_user.owned_projects.count > 0 | |
6 | - redirect_to account_profile_path, alert: "Remove projects and groups before removing account." and return | |
7 | - end | |
8 | 5 | current_user.destroy |
9 | 6 | |
10 | 7 | respond_to do |format| | ... | ... |
spec/features/profile_spec.rb
... | ... | @@ -17,26 +17,12 @@ describe "Profile account page" do |
17 | 17 | |
18 | 18 | it { page.should have_content("Remove account") } |
19 | 19 | |
20 | - it "should delete the account", js: true do | |
20 | + it "should delete the account" do | |
21 | 21 | expect { click_link "Delete account" }.to change {User.count}.by(-1) |
22 | 22 | current_path.should == new_user_session_path |
23 | 23 | end |
24 | 24 | end |
25 | 25 | |
26 | - describe "when signup is enabled and user has a project" do | |
27 | - before do | |
28 | - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) | |
29 | - @project = create(:project, namespace: @user.namespace) | |
30 | - @project.team << [@user, :master] | |
31 | - visit account_profile_path | |
32 | - end | |
33 | - it { page.should have_content("Remove account") } | |
34 | - | |
35 | - it "should not allow user to delete the account" do | |
36 | - expect { click_link "Delete account" }.not_to change {User.count}.by(-1) | |
37 | - end | |
38 | - end | |
39 | - | |
40 | 26 | describe "when signup is disabled" do |
41 | 27 | before do |
42 | 28 | Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) | ... | ... |