Files
moreminimore-chat/spec/lib/chatwoot_exception_tracker_spec.rb
2026-08-16 02:29:29 +07:00

23 lines
759 B
Ruby

require 'rails_helper'
describe ChatwootExceptionTracker do
it 'writes the exception to the Rails logger' do
exception = StandardError.new('local failure')
expect(Rails.logger).to receive(:error).with(exception)
described_class.new(exception).capture_exception
end
it 'stays local when a Sentry DSN is present' do
exception = StandardError.new('private failure')
user = build(:user, email: 'person@example.invalid', name: 'Private User')
account = build(:account, name: 'Private Account')
with_modified_env SENTRY_DSN: 'https://sentry.invalid/project' do
expect(Rails.logger).to receive(:error).with(exception)
described_class.new(exception, user: user, account: account).capture_exception
end
end
end