diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 18:09:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-05 18:09:06 +0000 |
commit | b042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (patch) | |
tree | de31671ab7c6ca8c2a3721cbabd1f2a42b3d0194 /spec/services/projects/operations | |
parent | eabf8fd774fef6a54903e5141138f47bdafeb331 (diff) | |
download | gitlab-ce-b042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects/operations')
-rw-r--r-- | spec/services/projects/operations/update_service_spec.rb | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/spec/services/projects/operations/update_service_spec.rb b/spec/services/projects/operations/update_service_spec.rb index d20ec0b818b..dce0ee05b1f 100644 --- a/spec/services/projects/operations/update_service_spec.rb +++ b/spec/services/projects/operations/update_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' describe Projects::Operations::UpdateService do let_it_be(:user) { create(:user) } - let_it_be(:project, reload: true) { create(:project) } + let_it_be(:project, refind: true) { create(:project) } let(:result) { subject.execute } @@ -145,6 +145,48 @@ describe Projects::Operations::UpdateService do end end + context 'partial_update' do + let(:params) do + { + error_tracking_setting_attributes: { + enabled: true + } + } + end + + context 'with setting' do + before do + create(:project_error_tracking_setting, :disabled, project: project) + end + + it 'service succeeds' do + expect(result[:status]).to eq(:success) + end + + it 'updates attributes' do + expect { result } + .to change { project.reload.error_tracking_setting.enabled } + .from(false) + .to(true) + end + + it 'only updates enabled attribute' do + result + + expect(project.error_tracking_setting.previous_changes.keys) + .to contain_exactly('enabled') + end + end + + context 'without setting' do + it 'does not create a setting' do + expect(result[:status]).to eq(:error) + + expect(project.reload.error_tracking_setting).to be_nil + end + end + end + context 'with masked param token' do let(:params) do { |