Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions sentry-ruby/spec/sentry/client_spec.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# frozen_string_literal: true

class ExceptionWithContext < StandardError
def sentry_context
{
foo: "bar"
}
end
end

RSpec.describe Sentry::Client do
subject { Sentry::Client.new(configuration) }

let(:configuration) do
Sentry::Configuration.new.tap do |config|
config.dsn = Sentry::TestHelper::DUMMY_DSN
config.transport.transport_class = Sentry::DummyTransport
end
end
subject { Sentry::Client.new(configuration) }

let(:hub) do
Sentry::Hub.new(subject, Sentry::Scope.new)
Expand Down Expand Up @@ -571,8 +564,18 @@ module ExcTag; end
end

context 'when the exception responds to sentry_context' do
let(:exception_with_context) do
Class.new(StandardError) do
def sentry_context
{
foo: "bar"
}
end
end
end

let(:hash) do
event = subject.event_from_exception(ExceptionWithContext.new)
event = subject.event_from_exception(exception_with_context.new)
event.to_h
end

Expand Down
Loading