feat: allow addtional context
This commit is contained in:
@@ -22,5 +22,20 @@ describe ChatwootExceptionTracker do
|
||||
described_class.new('random').capture_exception
|
||||
end
|
||||
end
|
||||
|
||||
it 'sets additional context when provided' do
|
||||
additional_context = { key1: 'value1', key2: 'value2' }
|
||||
|
||||
with_modified_env SENTRY_DSN: 'random dsn' do
|
||||
scope = instance_double(Sentry::Scope)
|
||||
allow(Sentry).to receive(:with_scope).and_yield(scope)
|
||||
|
||||
expect(scope).to receive(:set_context).with('key1', 'value1')
|
||||
expect(scope).to receive(:set_context).with('key2', 'value2')
|
||||
expect(Sentry).to receive(:capture_exception).with('random')
|
||||
|
||||
described_class.new('random', additional_context: additional_context).capture_exception
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user