diff options
| author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-17 21:08:24 +0000 |
|---|---|---|
| committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-17 21:08:24 +0000 |
| commit | 1b16af5ff9da84ff7779ea7d7db977d7c056baca (patch) | |
| tree | 09aabef12bdae93174d8dff4a5e53a424dc0c526 /spec/services/snippets/create_service_spec.rb | |
| parent | 6b922f9bb0a09fa74565a45e4af324d0324adba9 (diff) | |
| download | gitlab-ce-1b16af5ff9da84ff7779ea7d7db977d7c056baca.tar.gz | |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/snippets/create_service_spec.rb')
| -rw-r--r-- | spec/services/snippets/create_service_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb index fa8cbc87563..c88dabde9c7 100644 --- a/spec/services/snippets/create_service_spec.rb +++ b/spec/services/snippets/create_service_spec.rb @@ -283,6 +283,19 @@ describe Snippets::CreateService do expect(snippet.repository.exists?).to be_falsey end end + + context 'when snippet_files contain an action different from "create"' do + let(:snippet_files) { [{ action: 'delete', file_path: 'snippet_file_path.rb' }] } + + it 'a validation error is raised' do + response = subject + snippet = response.payload[:snippet] + + expect(response).to be_error + expect(snippet.errors.full_messages_for(:snippet_files)).to eq ['Snippet files have invalid data'] + expect(snippet.repository.exists?).to be_falsey + end + end end context 'when ProjectSnippet' do |
