diff options
author | Stan Hu <stanhu@gmail.com> | 2015-06-22 15:08:02 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-06-23 04:39:49 -0700 |
commit | e80d7a804f335447c8c4db8d8de3532957d80ec8 (patch) | |
tree | 0a6e720f703a922a69d59d64054cbde74d542d42 /spec | |
parent | 883438970df30ac7101d8f32b30007c4248c75d5 (diff) | |
download | gitlab-ce-e80d7a804f335447c8c4db8d8de3532957d80ec8.tar.gz |
Fix error when deleting a user who has projects
Closes #1856
Closes https://github.com/gitlabhq/gitlabhq/issues/9394
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/admin/users_controller_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb new file mode 100644 index 00000000000..f27e861e175 --- /dev/null +++ b/spec/controllers/admin/users_controller_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe Admin::UsersController do + let(:admin) { create(:admin) } + + before do + sign_in(admin) + end + + describe 'DELETE #user with projects' do + let(:user) { create(:user) } + let(:project) { create(:project, namespace: user.namespace) } + + before do + project.team << [user, :developer] + end + + it 'deletes user' do + delete :destroy, id: user.username, format: :json + expect(response.status).to eq(200) + expect { User.find(user.id) }.to raise_exception(ActiveRecord::RecordNotFound) + end + end +end |