Skip to content

Commit

Permalink
Fix error raise test
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Sep 19, 2023
1 parent f50f16b commit 0566002
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions helpers/mysql/test/helpers/mysql_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,15 @@
end

describe 'when an error is raised' do
let(:sql) { 1 }
it 'logs a message' do
result = nil
OpenTelemetry::TestHelpers.with_test_logger do |log_stream|
begin
result = extract_statement_type
rescue StandardError
# noop, let the error be caught
end
OpenTelemetry::Common::Utilities.stub(:utf8_encode, ->(_) { raise 'boom!' }) do
extract_statement_type

assert_nil(result)
assert_match(/Error extracting/, log_stream.string)
assert_nil(result)
assert_match(/Error extracting/, log_stream.string)
end
end
end
end
Expand Down

0 comments on commit 0566002

Please sign in to comment.