diff options
Diffstat (limited to 'spec/services/snippets')
-rw-r--r-- | spec/services/snippets/create_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/snippets/update_service_spec.rb | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb index b7fb5a98d06..96807fd629f 100644 --- a/spec/services/snippets/create_service_spec.rb +++ b/spec/services/snippets/create_service_spec.rb @@ -147,9 +147,11 @@ RSpec.describe Snippets::CreateService do end context 'when the commit action fails' do + let(:error) { SnippetRepository::CommitError.new('foobar') } + before do allow_next_instance_of(SnippetRepository) do |instance| - allow(instance).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError.new('foobar')) + allow(instance).to receive(:multi_files_action).and_raise(error) end end @@ -172,7 +174,7 @@ RSpec.describe Snippets::CreateService do end it 'logs the error' do - expect(Gitlab::AppLogger).to receive(:error).with('foobar') + expect(Gitlab::ErrorTracking).to receive(:log_exception).with(error, service: 'Snippets::CreateService') subject end diff --git a/spec/services/snippets/update_service_spec.rb b/spec/services/snippets/update_service_spec.rb index 406ece30bd7..a2341dc71b2 100644 --- a/spec/services/snippets/update_service_spec.rb +++ b/spec/services/snippets/update_service_spec.rb @@ -277,14 +277,14 @@ RSpec.describe Snippets::UpdateService do end context 'when an error is raised' do - let(:error_message) { 'foobar' } + let(:error) { SnippetRepository::CommitError.new('foobar') } before do - allow(snippet.snippet_repository).to receive(:multi_files_action).and_raise(SnippetRepository::CommitError, error_message) + allow(snippet.snippet_repository).to receive(:multi_files_action).and_raise(error) end it 'logs the error' do - expect(Gitlab::AppLogger).to receive(:error).with(error_message) + expect(Gitlab::ErrorTracking).to receive(:log_exception).with(error, service: 'Snippets::UpdateService') subject end |