Skip to content

Commit 37a1f85

Browse files
authored
Small clean up in client spec (#2778)
* chore(specs): minor formatting fix * fix(specs): remove global class from client spec
1 parent 6049bfd commit 37a1f85

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

sentry-ruby/spec/sentry/client_spec.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
# frozen_string_literal: true
22

3-
class ExceptionWithContext < StandardError
4-
def sentry_context
5-
{
6-
foo: "bar"
7-
}
8-
end
9-
end
10-
113
RSpec.describe Sentry::Client do
4+
subject { Sentry::Client.new(configuration) }
5+
126
let(:configuration) do
137
Sentry::Configuration.new.tap do |config|
148
config.dsn = Sentry::TestHelper::DUMMY_DSN
159
config.transport.transport_class = Sentry::DummyTransport
1610
end
1711
end
18-
subject { Sentry::Client.new(configuration) }
1912

2013
let(:hub) do
2114
Sentry::Hub.new(subject, Sentry::Scope.new)
@@ -571,8 +564,18 @@ module ExcTag; end
571564
end
572565

573566
context 'when the exception responds to sentry_context' do
567+
let(:exception_with_context) do
568+
Class.new(StandardError) do
569+
def sentry_context
570+
{
571+
foo: "bar"
572+
}
573+
end
574+
end
575+
end
576+
574577
let(:hash) do
575-
event = subject.event_from_exception(ExceptionWithContext.new)
578+
event = subject.event_from_exception(exception_with_context.new)
576579
event.to_h
577580
end
578581

0 commit comments

Comments
 (0)