Commit 4c3ec579 authored by James Lopez's avatar James Lopez

added more specs

parent fd5062a8
...@@ -82,6 +82,8 @@ class GroupsController < Groups::ApplicationController ...@@ -82,6 +82,8 @@ class GroupsController < Groups::ApplicationController
if Groups::UpdateService.new(@group, current_user, group_params).execute if Groups::UpdateService.new(@group, current_user, group_params).execute
redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated." redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated."
else else
@group.reload
render action: "edit" render action: "edit"
end end
end end
......
...@@ -122,8 +122,8 @@ describe GroupsController do ...@@ -122,8 +122,8 @@ describe GroupsController do
allow_any_instance_of(Group).to receive(:move_dir).and_raise(Gitlab::UpdatePathError) allow_any_instance_of(Group).to receive(:move_dir).and_raise(Gitlab::UpdatePathError)
post :update, id: group.to_param, group: { path: 'new_path' } post :update, id: group.to_param, group: { path: 'new_path' }
expect(response).to have_http_status(302) expect(assigns(:group).errors).not_to be_empty
expect(controller).to set_flash[:alert] expect(assigns(:group).path).not_to eq('new_path')
end end
end end
end end
...@@ -59,8 +59,6 @@ describe Groups::UpdateService, services: true do ...@@ -59,8 +59,6 @@ describe Groups::UpdateService, services: true do
end end
it 'returns true' do it 'returns true' do
puts internal_group.errors.full_messages
expect(service.execute).to eq(true) expect(service.execute).to eq(true)
end end
...@@ -82,6 +80,10 @@ describe Groups::UpdateService, services: true do ...@@ -82,6 +80,10 @@ describe Groups::UpdateService, services: true do
expect(internal_group.errors.full_messages.first).to eq('Gitlab::UpdatePathError') expect(internal_group.errors.full_messages.first).to eq('Gitlab::UpdatePathError')
end end
it "hasn't changed the path" do
expect { service.execute}.not_to change { internal_group.reload.path}
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment