|
7 | 7 | stubs = Faraday::Adapter::Test::Stubs.new do |stub| |
8 | 8 | stub.post('sentry/api/42/store/') { [200, {}, 'ok'] } |
9 | 9 | end |
| 10 | + io = StringIO.new |
10 | 11 |
|
11 | 12 | Raven.configure do |config| |
12 | 13 | config.server = 'http://12345:[email protected]/sentry/42' |
13 | 14 | config.environments = ["test"] |
14 | 15 | config.current_environment = "test" |
15 | 16 | config.http_adapter = [:test, stubs] |
| 17 | + config.logger = Logger.new(io) |
16 | 18 | end |
17 | 19 |
|
18 | 20 | Raven.capture_exception(build_exception) |
19 | 21 |
|
20 | 22 | stubs.verify_stubbed_calls |
21 | 23 |
|
| 24 | + expect(io.string).to match(/Sending event [0-9a-f]+ to Sentry$/) |
22 | 25 | end |
23 | 26 |
|
24 | 27 | example "posting an exception to a prefixed DSN" do |
|
60 | 63 | end |
61 | 64 |
|
62 | 65 | example "timed backoff should prevent sends" do |
| 66 | + io = StringIO.new |
63 | 67 | Raven.configure do |config| |
64 | 68 | config.server = 'http://12345:[email protected]/sentry/42' |
65 | 69 | config.environments = ["test"] |
66 | 70 | config.current_environment = "test" |
67 | 71 | config.http_adapter = [:test, nil] |
| 72 | + config.logger = Logger.new(io) |
68 | 73 | end |
69 | 74 |
|
70 | 75 | expect_any_instance_of(Raven::Transports::HTTP).to receive(:send).exactly(1).times.and_raise(Faraday::Error::ConnectionFailed, "conn failed") |
71 | 76 | expect { Raven.capture_exception(build_exception) }.not_to raise_error |
72 | 77 |
|
73 | 78 | expect(Raven.logger).to receive(:error).exactly(1).times |
74 | 79 | expect { Raven.capture_exception(build_exception) }.not_to raise_error |
| 80 | + expect(io.string).to match(/Failed to submit event: ZeroDivisionError: divided by 0$/) |
75 | 81 | end |
76 | 82 | end |
0 commit comments