|
22 | 22 | subject { client.transport }
|
23 | 23 |
|
24 | 24 | it "logs a debug message only during initialization" do
|
25 |
| - stub_request(build_fake_response("200")) |
| 25 | + sentry_stub_request(build_fake_response("200")) |
26 | 26 | string_io = StringIO.new
|
27 | 27 | configuration.logger = Logger.new(string_io)
|
28 | 28 |
|
|
39 | 39 | end
|
40 | 40 |
|
41 | 41 | it "initializes new Net::HTTP instance for every request" do
|
42 |
| - stub_request(build_fake_response("200")) do |request| |
| 42 | + sentry_stub_request(build_fake_response("200")) do |request| |
43 | 43 | expect(request["User-Agent"]).to eq("sentry-ruby/#{Sentry::VERSION}")
|
44 | 44 | end
|
45 | 45 |
|
|
87 | 87 | let(:fake_response) { build_fake_response("200") }
|
88 | 88 |
|
89 | 89 | it 'sets default User-Agent' do
|
90 |
| - stub_request(fake_response) do |request| |
| 90 | + sentry_stub_request(fake_response) do |request| |
91 | 91 | expect(request["User-Agent"]).to eq("sentry-ruby/#{Sentry::VERSION}")
|
92 | 92 | end
|
93 | 93 |
|
|
97 | 97 | it "accepts custom proxy" do
|
98 | 98 | configuration.transport.proxy = { uri: URI("https://example.com"), user: "stan", password: "foobar" }
|
99 | 99 |
|
100 |
| - stub_request(fake_response) do |_, http_obj| |
| 100 | + sentry_stub_request(fake_response) do |_, http_obj| |
101 | 101 | expect(http_obj.proxy_address).to eq("example.com")
|
102 | 102 | expect(http_obj.proxy_user).to eq("stan")
|
103 | 103 | expect(http_obj.proxy_pass).to eq("foobar")
|
|
109 | 109 | it "accepts a custom proxy string" do
|
110 | 110 | configuration.transport.proxy = "https://stan:[email protected]:8080"
|
111 | 111 |
|
112 |
| - stub_request(fake_response) do |_, http_obj| |
| 112 | + sentry_stub_request(fake_response) do |_, http_obj| |
113 | 113 | expect(http_obj.proxy_address).to eq("example.com")
|
114 | 114 | expect(http_obj.proxy_user).to eq("stan")
|
115 | 115 | expect(http_obj.proxy_pass).to eq("foobar")
|
|
122 | 122 | it "accepts a custom proxy URI" do
|
123 | 123 | configuration.transport.proxy = URI("https://stan:[email protected]:8080")
|
124 | 124 |
|
125 |
| - stub_request(fake_response) do |_, http_obj| |
| 125 | + sentry_stub_request(fake_response) do |_, http_obj| |
126 | 126 | expect(http_obj.proxy_address).to eq("example.com")
|
127 | 127 | expect(http_obj.proxy_user).to eq("stan")
|
128 | 128 | expect(http_obj.proxy_pass).to eq("foobar")
|
|
136 | 136 | begin
|
137 | 137 | ENV["http_proxy"] = "https://stan:[email protected]:8080"
|
138 | 138 |
|
139 |
| - stub_request(fake_response) do |_, http_obj| |
| 139 | + sentry_stub_request(fake_response) do |_, http_obj| |
140 | 140 | expect(http_obj.proxy_address).to eq("example.com")
|
141 | 141 | expect(http_obj.proxy_port).to eq(8080)
|
142 | 142 |
|
|
155 | 155 | it "accepts custom timeout" do
|
156 | 156 | configuration.transport.timeout = 10
|
157 | 157 |
|
158 |
| - stub_request(fake_response) do |_, http_obj| |
| 158 | + sentry_stub_request(fake_response) do |_, http_obj| |
159 | 159 | expect(http_obj.read_timeout).to eq(10)
|
160 | 160 |
|
161 | 161 | if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6")
|
|
169 | 169 | it "accepts custom open_timeout" do
|
170 | 170 | configuration.transport.open_timeout = 10
|
171 | 171 |
|
172 |
| - stub_request(fake_response) do |_, http_obj| |
| 172 | + sentry_stub_request(fake_response) do |_, http_obj| |
173 | 173 | expect(http_obj.open_timeout).to eq(10)
|
174 | 174 | end
|
175 | 175 |
|
|
178 | 178 |
|
179 | 179 | describe "ssl configurations" do
|
180 | 180 | it "has the corrent default" do
|
181 |
| - stub_request(fake_response) do |_, http_obj| |
| 181 | + sentry_stub_request(fake_response) do |_, http_obj| |
182 | 182 | expect(http_obj.verify_mode).to eq(1)
|
183 | 183 | expect(http_obj.ca_file).to eq(nil)
|
184 | 184 | end
|
|
189 | 189 | it "accepts custom ssl_verification configuration" do
|
190 | 190 | configuration.transport.ssl_verification = false
|
191 | 191 |
|
192 |
| - stub_request(fake_response) do |_, http_obj| |
| 192 | + sentry_stub_request(fake_response) do |_, http_obj| |
193 | 193 | expect(http_obj.verify_mode).to eq(0)
|
194 | 194 | expect(http_obj.ca_file).to eq(nil)
|
195 | 195 | end
|
|
200 | 200 | it "accepts custom ssl_ca_file configuration" do
|
201 | 201 | configuration.transport.ssl_ca_file = "/tmp/foo"
|
202 | 202 |
|
203 |
| - stub_request(fake_response) do |_, http_obj| |
| 203 | + sentry_stub_request(fake_response) do |_, http_obj| |
204 | 204 | expect(http_obj.verify_mode).to eq(1)
|
205 | 205 | expect(http_obj.ca_file).to eq("/tmp/foo")
|
206 | 206 | end
|
|
211 | 211 | it "accepts custom ssl configuration" do
|
212 | 212 | configuration.transport.ssl = { verify: false, ca_file: "/tmp/foo" }
|
213 | 213 |
|
214 |
| - stub_request(fake_response) do |_, http_obj| |
| 214 | + sentry_stub_request(fake_response) do |_, http_obj| |
215 | 215 | expect(http_obj.verify_mode).to eq(0)
|
216 | 216 | expect(http_obj.ca_file).to eq("/tmp/foo")
|
217 | 217 | end
|
|
225 | 225 | let(:fake_response) { build_fake_response("200") }
|
226 | 226 |
|
227 | 227 | it "compresses data by default" do
|
228 |
| - stub_request(fake_response) do |request| |
| 228 | + sentry_stub_request(fake_response) do |request| |
229 | 229 | expect(request["Content-Type"]).to eq("application/x-sentry-envelope")
|
230 | 230 | expect(request["Content-Encoding"]).to eq("gzip")
|
231 | 231 |
|
|
238 | 238 | end
|
239 | 239 |
|
240 | 240 | it "doesn't compress small event" do
|
241 |
| - stub_request(fake_response) do |request| |
| 241 | + sentry_stub_request(fake_response) do |request| |
242 | 242 | expect(request["Content-Type"]).to eq("application/x-sentry-envelope")
|
243 | 243 | expect(request["Content-Encoding"]).to eq("")
|
244 | 244 |
|
|
255 | 255 | it "doesn't compress data if the encoding is not gzip" do
|
256 | 256 | configuration.transport.encoding = "json"
|
257 | 257 |
|
258 |
| - stub_request(fake_response) do |request| |
| 258 | + sentry_stub_request(fake_response) do |request| |
259 | 259 | expect(request["Content-Type"]).to eq("application/x-sentry-envelope")
|
260 | 260 | expect(request["Content-Encoding"]).to eq("")
|
261 | 261 |
|
|
296 | 296 | let(:fake_response) { build_fake_response("404") }
|
297 | 297 |
|
298 | 298 | it "raises an error" do
|
299 |
| - stub_request(fake_response) |
| 299 | + sentry_stub_request(fake_response) |
300 | 300 |
|
301 | 301 | expect { subject.send_data(data) }.to raise_error(Sentry::ExternalError, /the server responded with status 404/)
|
302 | 302 | end
|
|
306 | 306 | let(:fake_response) { build_fake_response("500") }
|
307 | 307 |
|
308 | 308 | it "raises an error" do
|
309 |
| - stub_request(fake_response) |
| 309 | + sentry_stub_request(fake_response) |
310 | 310 |
|
311 | 311 | expect { subject.send_data(data) }.to raise_error(Sentry::ExternalError, /the server responded with status 500/)
|
312 | 312 | end
|
|
318 | 318 | end
|
319 | 319 |
|
320 | 320 | it "raises an error with header" do
|
321 |
| - stub_request(error_response) |
| 321 | + sentry_stub_request(error_response) |
322 | 322 |
|
323 | 323 | expect { subject.send_data(data) }.to raise_error(Sentry::ExternalError, /error_in_header/)
|
324 | 324 | end
|
|
0 commit comments