summaryrefslogtreecommitdiff
path: root/spec/controllers/groups_controller_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-12-20 17:52:27 +0100
committerJames Lopez <james@jameslopez.es>2016-12-20 17:52:27 +0100
commitb82fdf6257255b720526ccef716759892e88de09 (patch)
tree52c4adbaa69a9e4b4174b6efc0f817ffda64d815 /spec/controllers/groups_controller_spec.rb
parentad1a1d976c877eca16858368db0c5b3ef800db8b (diff)
downloadgitlab-ce-b82fdf6257255b720526ccef716759892e88de09.tar.gz
Fix error 500 renaming group. Also added specs and changelog.
Diffstat (limited to 'spec/controllers/groups_controller_spec.rb')
-rw-r--r--spec/controllers/groups_controller_spec.rb21
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..4bb37bc52ee 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(response).to have_http_status(302)
+ expect(controller).to set_flash[:alert]
+ end
+ end
end