diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-12-21 14:54:02 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-12-21 14:54:02 +0000 |
commit | 6e8ba3b79f2a64496fae4506dea224cc995898d2 (patch) | |
tree | 4e69812a1b7b05032efd213972f267b962d60390 /spec/controllers | |
parent | cc02bb2ac347fc2b5b94f49cb2f84ee03cc9a3a7 (diff) | |
parent | b902784dbff64d1f746fc38249a814debb8ed325 (diff) | |
download | gitlab-ce-6e8ba3b79f2a64496fae4506dea224cc995898d2.tar.gz |
Merge branch 'fix/group-path-rename-error' into 'master'
Fix error 500 renaming group. Also added specs and changelog.
Closes #17922 and #23223
See merge request !8201
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index a763e2c5ba8..98dfb3e5216 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -105,4 +105,25 @@ describe GroupsController do end end end + + describe 'PUT update' do + before do + sign_in(user) + end + + it 'updates the path succesfully' do + post :update, id: group.to_param, group: { path: 'new_path' } + + expect(response).to have_http_status(302) + expect(controller).to set_flash[:notice] + end + + it 'does not update the path on error' do + allow_any_instance_of(Group).to receive(:move_dir).and_raise(Gitlab::UpdatePathError) + post :update, id: group.to_param, group: { path: 'new_path' } + + expect(assigns(:group).errors).not_to be_empty + expect(assigns(:group).path).not_to eq('new_path') + end + end end |