Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 18:07:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 18:07:45 +0300
commit1219a9dce91f4edbc135dfc08299b4122b4825a8 (patch)
treee7d12a55d75a2d56e60d9527bef3724e3578866d /spec/services/snippets
parent1a0d6dbdc2ac3047f4953a359ef27ba6e26074ae (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/snippets')
-rw-r--r--spec/services/snippets/update_service_spec.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/services/snippets/update_service_spec.rb b/spec/services/snippets/update_service_spec.rb
index 03dc857c666..9c88e741d51 100644
--- a/spec/services/snippets/update_service_spec.rb
+++ b/spec/services/snippets/update_service_spec.rb
@@ -141,14 +141,16 @@ describe Snippets::UpdateService do
end
it 'returns error when the commit action fails' do
+ error_message = 'foobar'
+
allow_next_instance_of(SnippetRepository) do |instance|
- allow(instance).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError)
+ allow(instance).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError, error_message)
end
response = subject
expect(response).to be_error
- expect(response.payload[:snippet].errors.full_messages).to eq ['Repository Error updating the snippet']
+ expect(response.payload[:snippet].errors[:repository].to_sentence).to eq error_message
end
end
@@ -168,12 +170,14 @@ describe Snippets::UpdateService do
end
context 'when an error is raised' do
+ let(:error_message) { 'foobar' }
+
before do
- allow(snippet.snippet_repository).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError, 'foobar')
+ allow(snippet.snippet_repository).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError, error_message)
end
it 'logs the error' do
- expect(Gitlab::AppLogger).to receive(:error).with('foobar')
+ expect(Gitlab::AppLogger).to receive(:error).with(error_message)
subject
end
@@ -182,7 +186,7 @@ describe Snippets::UpdateService do
response = subject
expect(response).to be_error
- expect(response.payload[:snippet].errors.full_messages).to eq ['Repository Error updating the snippet']
+ expect(response.payload[:snippet].errors[:repository].to_sentence).to eq error_message
end
end