diff options
author | James Lopez <james@jameslopez.es> | 2016-12-21 13:29:27 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-12-21 13:29:27 +0100 |
commit | 4c3ec579e5660daab23d48bd4b3e21050735f726 (patch) | |
tree | 23722f566de4f61b48eb7436174bf6c37dd011e1 | |
parent | fd5062a848d63b89248c384e0171c6f1af833a49 (diff) | |
download | gitlab-ce-4c3ec579e5660daab23d48bd4b3e21050735f726.tar.gz |
added more specs
-rw-r--r-- | app/controllers/groups_controller.rb | 2 | ||||
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/groups/update_service_spec.rb | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index b83c3a872cf..1e499199f82 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -82,6 +82,8 @@ class GroupsController < Groups::ApplicationController if Groups::UpdateService.new(@group, current_user, group_params).execute redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated." else + @group.reload + render action: "edit" end end diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 4bb37bc52ee..98dfb3e5216 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -122,8 +122,8 @@ describe GroupsController 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] + expect(assigns(:group).errors).not_to be_empty + expect(assigns(:group).path).not_to eq('new_path') end end end diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index 8ac5736cbb3..531180e48a1 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -59,8 +59,6 @@ describe Groups::UpdateService, services: true do end it 'returns true' do - puts internal_group.errors.full_messages - expect(service.execute).to eq(true) end @@ -82,6 +80,10 @@ describe Groups::UpdateService, services: true do expect(internal_group.errors.full_messages.first).to eq('Gitlab::UpdatePathError') end + + it "hasn't changed the path" do + expect { service.execute}.not_to change { internal_group.reload.path} + end end end end |