diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-18 09:21:19 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-18 09:21:19 +0000 |
commit | 1bd7e06a8564f3f941444fc9cad69cebb6e3ae9a (patch) | |
tree | 4e1cdf474101b6383cf234311009e72da2dc2c77 | |
parent | 2451bae55af2928d62e267b258efc097e982e11c (diff) | |
parent | 3ea988e854b09a224e75011d6169d756e394456a (diff) | |
download | gitlab-ce-1bd7e06a8564f3f941444fc9cad69cebb6e3ae9a.tar.gz |
Merge branch 'sh-backport-update-service-fix' into 'master'
Fix Groups::UpdateService#execute not returning correct error code
See merge request gitlab-org/gitlab-ce!22446
-rw-r--r-- | app/services/groups/update_service.rb | 6 | ||||
-rw-r--r-- | spec/services/groups/update_service_spec.rb | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index fe47aa2f140..0bf0e967dcc 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -14,9 +14,11 @@ module Groups group.assign_attributes(params) begin - after_update if group.save + success = group.save - true + after_update if success + + success rescue Gitlab::UpdatePathError => e group.errors.add(:base, e.message) diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index 7c5c7409cc1..84cfa53ea05 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -24,6 +24,12 @@ describe Groups::UpdateService do expect(TodosDestroyer::GroupPrivateWorker).not_to receive(:perform_in) end + + it "returns false if save failed" do + allow(public_group).to receive(:save).and_return(false) + + expect(service.execute).to be_falsey + end end context "internal group with internal project" do |