File tree Expand file tree Collapse file tree 8 files changed +30
-43
lines changed
Expand file tree Collapse file tree 8 files changed +30
-43
lines changed Original file line number Diff line number Diff line change 1616 )
1717 end
1818
19- let ( :problematic_crumb ) do
20- # circular reference
21- a = [ ]
22- b = [ ]
23- a . push ( b )
24- b . push ( a )
25-
26- Sentry ::Breadcrumb . new (
27- category : "baz" ,
28- message : "I cause issues" ,
29- data : a
30- )
31- end
32-
3319 describe "#initialize" do
3420 it "limits the maximum size of message" do
3521 long_message = "a" * Sentry ::Event ::MAX_MESSAGE_SIZE_IN_BYTES * 2
5036 end
5137
5238 describe "#to_hash" do
39+ let ( :problematic_crumb ) do
40+ # circular reference
41+ a = [ ]
42+ b = [ ]
43+ a . push ( b )
44+ b . push ( a )
45+
46+ Sentry ::Breadcrumb . new (
47+ category : "baz" ,
48+ message : "I cause issues" ,
49+ data : a
50+ )
51+ end
52+
5353 it "serializes data correctly" do
5454 result = crumb . to_hash
5555
Original file line number Diff line number Diff line change 33RSpec . describe Sentry ::Client do
44 let ( :configuration ) do
55 Sentry ::Configuration . new . tap do |config |
6+ config . logger = Logger . new ( nil )
67 config . dsn = DUMMY_DSN
78 config . transport . transport_class = Sentry ::DummyTransport
89 end
Original file line number Diff line number Diff line change @@ -251,22 +251,19 @@ module ExcTag; end
251251 end
252252 end
253253
254- # Only check causes when they're supported
255- if Exception . new . respond_to? :cause
256- context 'when the exception has a cause' do
257- let ( :exception ) { build_exception_with_cause }
254+ context 'when the exception has a cause' do
255+ let ( :exception ) { build_exception_with_cause }
258256
259- it 'captures the cause' do
260- expect ( hash [ :exception ] [ :values ] . length ) . to eq ( 2 )
261- end
257+ it 'captures the cause' do
258+ expect ( hash [ :exception ] [ :values ] . length ) . to eq ( 2 )
262259 end
260+ end
263261
264- context 'when the exception has nested causes' do
265- let ( :exception ) { build_exception_with_two_causes }
262+ context 'when the exception has nested causes' do
263+ let ( :exception ) { build_exception_with_two_causes }
266264
267- it 'captures nested causes' do
268- expect ( hash [ :exception ] [ :values ] . length ) . to eq ( 3 )
269- end
265+ it 'captures nested causes' do
266+ expect ( hash [ :exception ] [ :values ] . length ) . to eq ( 3 )
270267 end
271268 end
272269
Original file line number Diff line number Diff line change @@ -279,17 +279,9 @@ class MyTestException < RuntimeError; end
279279 subject . inspect_exception_causes_for_exclusion = true
280280 end
281281
282- if Exception . new . respond_to? :cause
283- context 'when the language version supports exception causes' do
284- it 'returns false' do
285- expect ( subject . exception_class_allowed? ( incoming_exception ) ) . to eq false
286- end
287- end
288- else
289- context 'when the language version does not support exception causes' do
290- it 'returns true' do
291- expect ( subject . exception_class_allowed? ( incoming_exception ) ) . to eq true
292- end
282+ context 'when the language version supports exception causes' do
283+ it 'returns false' do
284+ expect ( subject . exception_class_allowed? ( incoming_exception ) ) . to eq false
293285 end
294286 end
295287 end
Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ def inspect
159159 describe "state encapsulation" do
160160 before do
161161 Sentry . configure_scope { |s | s . set_tags ( tag_1 : "don't change me" ) }
162+ Sentry . configuration . breadcrumbs_logger = [ :sentry_logger ]
162163 end
163164
164165 it "only contains the breadcrumbs of the request" do
Original file line number Diff line number Diff line change 99 Sentry . configuration
1010 end
1111 let ( :client ) { Sentry . get_current_client }
12- let ( :event ) { client . event_from_message ( "foobarbaz" ) }
1312 let ( :data ) do
14- subject . encode ( event . to_hash )
13+ subject . encode ( client . event_from_message ( "foobarbaz" ) . to_hash )
1514 end
1615
1716 subject { Sentry ::HTTPTransport . new ( configuration ) }
Original file line number Diff line number Diff line change 522522 let ( :fake_root ) { "/tmp/sentry/" }
523523
524524 before do
525- allow ( File ) . to receive ( :directory? ) . and_return ( false )
526525 allow_any_instance_of ( Sentry ::Configuration ) . to receive ( :project_root ) . and_return ( fake_root )
527526 ENV [ "SENTRY_DSN" ] = DUMMY_DSN
528527 end
529528
530- subject { described_class . configuration }
531-
532529 it 'defaults to nil' do
533530 described_class . init
534531 expect ( described_class . configuration . release ) . to eq ( nil )
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def build_exception_with_recursive_cause
8181
8282def perform_basic_setup
8383 Sentry . init do |config |
84- config . breadcrumbs_logger = [ :sentry_logger ]
84+ config . logger = Logger . new ( nil )
8585 config . dsn = DUMMY_DSN
8686 config . transport . transport_class = Sentry ::DummyTransport
8787 # so the events will be sent synchronously for testing
You can’t perform that action at this time.
0 commit comments