airbrake 4.3.8 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/airbrake/capistrano/tasks.rb +64 -0
- data/lib/airbrake/delayed_job/plugin.rb +48 -0
- data/lib/airbrake/rack/middleware.rb +45 -0
- data/lib/airbrake/rack/notice_builder.rb +80 -0
- data/lib/airbrake/rack/user.rb +51 -0
- data/lib/airbrake/rails/action_controller.rb +35 -0
- data/lib/airbrake/rails/active_job.rb +23 -0
- data/lib/airbrake/rails/active_record.rb +40 -0
- data/lib/airbrake/rails/railtie.rb +61 -0
- data/lib/airbrake/rake/task_ext.rb +61 -0
- data/lib/airbrake/rake/tasks.rb +93 -0
- data/lib/airbrake/resque/failure.rb +19 -0
- data/lib/airbrake/sidekiq/error_handler.rb +35 -0
- data/lib/airbrake/version.rb +4 -1
- data/lib/airbrake.rb +16 -185
- data/lib/generators/airbrake_generator.rb +25 -0
- data/lib/generators/airbrake_initializer.rb.erb +55 -0
- data/spec/airbrake_spec.rb +0 -0
- data/spec/apps/rack/dummy_app.rb +17 -0
- data/spec/apps/rails/dummy_app.rb +150 -0
- data/spec/apps/rails/dummy_task.rake +20 -0
- data/spec/apps/rails/logs/32.log +13358 -0
- data/spec/apps/rails/logs/40.log +6854 -0
- data/spec/apps/rails/logs/41.log +3170 -0
- data/spec/apps/rails/logs/42.log +23919 -0
- data/spec/apps/rails/logs/50.log +10976 -0
- data/spec/apps/sinatra/dummy_app.rb +12 -0
- data/spec/integration/rack/rack_spec.rb +17 -0
- data/spec/integration/rails/rails_spec.rb +135 -0
- data/spec/integration/rails/rake_spec.rb +160 -0
- data/spec/integration/shared_examples/rack_examples.rb +106 -0
- data/spec/integration/sinatra/sinatra_spec.rb +15 -0
- data/spec/spec_helper.rb +127 -0
- data/spec/unit/rack/middleware_spec.rb +80 -0
- data/spec/unit/rack/notice_builder_spec.rb +35 -0
- data/spec/unit/rack/user_spec.rb +78 -0
- data/spec/unit/rake/tasks_spec.rb +40 -0
- data/spec/unit/sidekiq/error_handler_spec.rb +29 -0
- metadata +108 -323
- data/CHANGELOG +0 -1716
- data/Gemfile +0 -3
- data/Guardfile +0 -6
- data/INSTALL +0 -20
- data/LICENSE +0 -61
- data/README.md +0 -148
- data/README_FOR_HEROKU_ADDON.md +0 -102
- data/Rakefile +0 -179
- data/TESTED_AGAINST +0 -7
- data/airbrake.gemspec +0 -41
- data/bin/airbrake +0 -12
- data/features/metal.feature +0 -34
- data/features/rack.feature +0 -60
- data/features/rails.feature +0 -324
- data/features/rake.feature +0 -33
- data/features/sinatra.feature +0 -126
- data/features/step_definitions/file_steps.rb +0 -14
- data/features/step_definitions/rack_steps.rb +0 -27
- data/features/step_definitions/rails_application_steps.rb +0 -267
- data/features/step_definitions/rake_steps.rb +0 -22
- data/features/support/airbrake_shim.rb.template +0 -11
- data/features/support/aruba.rb +0 -5
- data/features/support/env.rb +0 -39
- data/features/support/matchers.rb +0 -35
- data/features/support/rails.rb +0 -156
- data/features/support/rake/Rakefile +0 -77
- data/features/user_informer.feature +0 -57
- data/generators/airbrake/airbrake_generator.rb +0 -94
- data/generators/airbrake/lib/insert_commands.rb +0 -34
- data/generators/airbrake/lib/rake_commands.rb +0 -24
- data/generators/airbrake/templates/airbrake_tasks.rake +0 -25
- data/generators/airbrake/templates/capistrano_hook.rb +0 -6
- data/generators/airbrake/templates/initializer.rb +0 -4
- data/install.rb +0 -1
- data/lib/airbrake/backtrace.rb +0 -103
- data/lib/airbrake/capistrano.rb +0 -103
- data/lib/airbrake/capistrano3.rb +0 -3
- data/lib/airbrake/cli/client.rb +0 -76
- data/lib/airbrake/cli/options.rb +0 -45
- data/lib/airbrake/cli/printer.rb +0 -33
- data/lib/airbrake/cli/project.rb +0 -17
- data/lib/airbrake/cli/project_factory.rb +0 -33
- data/lib/airbrake/cli/runner.rb +0 -49
- data/lib/airbrake/cli/validator.rb +0 -8
- data/lib/airbrake/configuration.rb +0 -366
- data/lib/airbrake/jobs/send_job.rb +0 -7
- data/lib/airbrake/notice.rb +0 -411
- data/lib/airbrake/rack.rb +0 -64
- data/lib/airbrake/rails/action_controller_catcher.rb +0 -32
- data/lib/airbrake/rails/controller_methods.rb +0 -146
- data/lib/airbrake/rails/error_lookup.rb +0 -35
- data/lib/airbrake/rails/middleware.rb +0 -63
- data/lib/airbrake/rails.rb +0 -45
- data/lib/airbrake/rails3_tasks.rb +0 -126
- data/lib/airbrake/railtie.rb +0 -46
- data/lib/airbrake/rake_handler.rb +0 -75
- data/lib/airbrake/response.rb +0 -29
- data/lib/airbrake/sender.rb +0 -213
- data/lib/airbrake/shared_tasks.rb +0 -59
- data/lib/airbrake/sidekiq.rb +0 -8
- data/lib/airbrake/sinatra.rb +0 -40
- data/lib/airbrake/tasks/airbrake.cap +0 -28
- data/lib/airbrake/tasks.rb +0 -81
- data/lib/airbrake/user_informer.rb +0 -36
- data/lib/airbrake/utils/params_cleaner.rb +0 -141
- data/lib/airbrake/utils/rack_filters.rb +0 -45
- data/lib/airbrake_tasks.rb +0 -62
- data/lib/rails/generators/airbrake/airbrake_generator.rb +0 -155
- data/lib/templates/rescue.erb +0 -91
- data/rails/init.rb +0 -1
- data/resources/README.md +0 -34
- data/resources/airbrake_2_4.xsd +0 -89
- data/resources/airbrake_3_0.json +0 -52
- data/resources/ca-bundle.crt +0 -3376
- data/script/integration_test.rb +0 -35
- data/test/airbrake_tasks_test.rb +0 -161
- data/test/backtrace_test.rb +0 -215
- data/test/capistrano_test.rb +0 -44
- data/test/configuration_test.rb +0 -303
- data/test/controller_methods_test.rb +0 -230
- data/test/helper.rb +0 -233
- data/test/integration/catcher_test.rb +0 -371
- data/test/integration.rb +0 -13
- data/test/logger_test.rb +0 -79
- data/test/notice_test.rb +0 -494
- data/test/notifier_test.rb +0 -288
- data/test/params_cleaner_test.rb +0 -204
- data/test/rack_test.rb +0 -62
- data/test/rails_initializer_test.rb +0 -36
- data/test/recursion_test.rb +0 -10
- data/test/response_test.rb +0 -18
- data/test/sender_test.rb +0 -335
- data/test/support/response_shim.xml +0 -4
- data/test/user_informer_test.rb +0 -29
data/test/sender_test.rb
DELETED
@@ -1,335 +0,0 @@
|
|
1
|
-
require File.expand_path '../helper', __FILE__
|
2
|
-
|
3
|
-
class SenderTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
reset_config
|
7
|
-
end
|
8
|
-
|
9
|
-
def build_sender(opts = {})
|
10
|
-
Airbrake.configure do |conf|
|
11
|
-
opts.each {|opt, value| conf.send(:"#{opt}=", value) }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def send_exception(args = {})
|
16
|
-
notice = args.delete(:notice) || build_notice_data
|
17
|
-
notice.stubs(:to_xml)
|
18
|
-
sender = args.delete(:sender) || build_sender(args)
|
19
|
-
sender.send_to_airbrake(notice)
|
20
|
-
end
|
21
|
-
|
22
|
-
def stub_http(options = {})
|
23
|
-
response = stub(:body => options[:body] || 'body')
|
24
|
-
http = stub(:post => response,
|
25
|
-
:read_timeout= => nil,
|
26
|
-
:open_timeout= => nil,
|
27
|
-
:ca_file= => nil,
|
28
|
-
:verify_mode= => nil,
|
29
|
-
:use_ssl= => nil)
|
30
|
-
Net::HTTP.stubs(:new => http)
|
31
|
-
http
|
32
|
-
end
|
33
|
-
|
34
|
-
should "post to Airbrake when using an HTTP proxy" do
|
35
|
-
response = stub(:body => 'body')
|
36
|
-
http = stub(:post => response,
|
37
|
-
:read_timeout= => nil,
|
38
|
-
:open_timeout= => nil,
|
39
|
-
:use_ssl= => nil)
|
40
|
-
proxy = stub(:new => http)
|
41
|
-
Net::HTTP.stubs(:Proxy => proxy)
|
42
|
-
|
43
|
-
url = "http://api.airbrake.io:80#{Airbrake::Sender::NOTICES_URI}"
|
44
|
-
uri = URI.parse(url)
|
45
|
-
|
46
|
-
proxy_host = 'some.host'
|
47
|
-
proxy_port = 88
|
48
|
-
proxy_user = 'login'
|
49
|
-
proxy_pass = 'passwd'
|
50
|
-
|
51
|
-
send_exception(:proxy_host => proxy_host,
|
52
|
-
:proxy_port => proxy_port,
|
53
|
-
:proxy_user => proxy_user,
|
54
|
-
:proxy_pass => proxy_pass)
|
55
|
-
assert_received(http, :post) do |expect|
|
56
|
-
expect.with(uri.path, anything, Airbrake::Sender::HEADERS[:xml])
|
57
|
-
end
|
58
|
-
assert_received(Net::HTTP, :Proxy) do |expect|
|
59
|
-
expect.with(proxy_host, proxy_port, proxy_user, proxy_pass)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
should "return the created group's id on successful posting" do
|
64
|
-
stub_http(:body => '<id type="integer">3799307</id>')
|
65
|
-
assert_equal "3799307", send_exception(:secure => false)
|
66
|
-
end
|
67
|
-
|
68
|
-
context "when using the XML API" do
|
69
|
-
|
70
|
-
should "post to Airbrake with XML passed" do
|
71
|
-
xml_notice = Airbrake::Notice.new(:error_class => "FooBar", :error_message => "Foo Bar").to_xml
|
72
|
-
|
73
|
-
http = stub_http
|
74
|
-
|
75
|
-
sender = build_sender
|
76
|
-
sender.send_to_airbrake(xml_notice)
|
77
|
-
|
78
|
-
assert_received(http, :post) do |expect|
|
79
|
-
expect.with(anything, xml_notice, Airbrake::Sender::HEADERS[:xml])
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
should "post to Airbrake with a Notice instance passed" do
|
84
|
-
notice = Airbrake::Notice.new(:error_class => "FooBar", :error_message => "Foo Bar")
|
85
|
-
|
86
|
-
http = stub_http
|
87
|
-
|
88
|
-
sender = build_sender
|
89
|
-
sender.send_to_airbrake(notice)
|
90
|
-
|
91
|
-
assert_received(http, :post) do |expect|
|
92
|
-
expect.with(anything, notice.to_xml, Airbrake::Sender::HEADERS[:xml])
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
end
|
97
|
-
|
98
|
-
context "when using new JSON API" do
|
99
|
-
should "post to Airbrake with JSON passed" do
|
100
|
-
json_notice = Airbrake::Notice.new(:error_class => "FooBar", :error_message => "Foo Bar").to_json
|
101
|
-
|
102
|
-
http = stub_http
|
103
|
-
|
104
|
-
sender = build_sender(:project_id => "PROJECT_ID", :host => "collect.airbrake.io")
|
105
|
-
sender.send_to_airbrake(json_notice)
|
106
|
-
|
107
|
-
assert_received(http, :post) do |expect|
|
108
|
-
expect.with(anything, json_notice, Airbrake::Sender::HEADERS[:json])
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
should "post to Airbrake keeping the apiKey in the URL" do
|
113
|
-
json_notice = Airbrake::Notice.new(:error_class => "FooBar", :error_message => "Foo Bar").to_json
|
114
|
-
|
115
|
-
http = stub_http
|
116
|
-
|
117
|
-
sender = build_sender(:project_id => "PROJECT_ID", :host => "collect.airbrake.io")
|
118
|
-
sender.send_to_airbrake(json_notice)
|
119
|
-
|
120
|
-
expected_url = format("%s/PROJECT_ID/notices?key=%s",
|
121
|
-
Airbrake::Sender::JSON_API_URI,
|
122
|
-
Airbrake.configuration[:api_key])
|
123
|
-
|
124
|
-
assert_received(http, :post) do |expect|
|
125
|
-
expect.with(expected_url, json_notice, Airbrake::Sender::HEADERS[:json])
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
should "post to Airbrake with notice passed" do
|
130
|
-
notice = Airbrake::Notice.new(:error_class => "FooBar", :error_message => "Foo Bar")
|
131
|
-
|
132
|
-
http = stub_http
|
133
|
-
|
134
|
-
sender = build_sender(:project_id => "PROJECT_ID", :host => "collect.airbrake.io")
|
135
|
-
sender.send_to_airbrake(notice)
|
136
|
-
|
137
|
-
assert_received(http, :post) do |expect|
|
138
|
-
expect.with(anything, notice.to_json, Airbrake::Sender::HEADERS[:json])
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
context "when encountering exceptions: " do
|
145
|
-
context "HTTP connection setup problems" do
|
146
|
-
should "not be rescued" do
|
147
|
-
proxy = stub()
|
148
|
-
proxy.stubs(:new).raises(NoMemoryError)
|
149
|
-
Net::HTTP.stubs(:Proxy => proxy)
|
150
|
-
|
151
|
-
assert_raise NoMemoryError do
|
152
|
-
build_sender.send(:setup_http_connection)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
should "be logged" do
|
157
|
-
proxy = stub()
|
158
|
-
proxy.stubs(:new).raises(RuntimeError)
|
159
|
-
Net::HTTP.stubs(:Proxy => proxy)
|
160
|
-
|
161
|
-
sender = build_sender
|
162
|
-
sender.expects(:log)
|
163
|
-
|
164
|
-
assert_raise RuntimeError do
|
165
|
-
sender.send(:setup_http_connection)
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
context "unexpected exception sending problems" do
|
172
|
-
should "be logged" do
|
173
|
-
sender = build_sender
|
174
|
-
sender.stubs(:setup_http_connection).raises(RuntimeError.new)
|
175
|
-
|
176
|
-
sender.expects(:log)
|
177
|
-
send_exception(:sender => sender)
|
178
|
-
end
|
179
|
-
|
180
|
-
should "return nil no matter what" do
|
181
|
-
sender = build_sender
|
182
|
-
sender.stubs(:setup_http_connection).raises(LocalJumpError)
|
183
|
-
|
184
|
-
assert_nothing_thrown do
|
185
|
-
assert_nil sender.send_to_airbrake(build_notice_data)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
should "return nil on failed posting" do
|
191
|
-
http = stub_http
|
192
|
-
http.stubs(:post).raises(Errno::ECONNREFUSED)
|
193
|
-
assert_equal nil, send_exception(:secure => false)
|
194
|
-
end
|
195
|
-
|
196
|
-
should "not fail when posting and a timeout exception occurs" do
|
197
|
-
http = stub_http
|
198
|
-
http.stubs(:post).raises(TimeoutError)
|
199
|
-
assert_nothing_thrown do
|
200
|
-
send_exception(:secure => false)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
should "not fail when posting and a connection refused exception occurs" do
|
205
|
-
http = stub_http
|
206
|
-
http.stubs(:post).raises(Errno::ECONNREFUSED)
|
207
|
-
assert_nothing_thrown do
|
208
|
-
send_exception(:secure => false)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
should "not fail when posting any http exception occurs" do
|
213
|
-
http = stub_http
|
214
|
-
Airbrake::Sender::HTTP_ERRORS.each do |error|
|
215
|
-
http.stubs(:post).raises(error)
|
216
|
-
assert_nothing_thrown do
|
217
|
-
send_exception(:secure => false)
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
context "SSL" do
|
224
|
-
should "post to the right url for non-ssl" do
|
225
|
-
http = stub_http
|
226
|
-
url = "http://api.airbrake.io:80#{Airbrake::Sender::NOTICES_URI}"
|
227
|
-
uri = URI.parse(url)
|
228
|
-
send_exception(:secure => false)
|
229
|
-
assert_received(http, :post) {|expect| expect.with(uri.path, anything, Airbrake::Sender::HEADERS[:xml]) }
|
230
|
-
end
|
231
|
-
|
232
|
-
should "post to the right path for ssl" do
|
233
|
-
http = stub_http
|
234
|
-
send_exception(:secure => true)
|
235
|
-
assert_received(http, :post) {|expect| expect.with(Airbrake::Sender::NOTICES_URI, anything, Airbrake::Sender::HEADERS[:xml]) }
|
236
|
-
end
|
237
|
-
|
238
|
-
should "verify the SSL peer when the use_ssl option is set to true" do
|
239
|
-
url = "https://api.airbrake.io#{Airbrake::Sender::NOTICES_URI}"
|
240
|
-
uri = URI.parse(url)
|
241
|
-
|
242
|
-
real_http = Net::HTTP.new(uri.host, uri.port)
|
243
|
-
real_http.stubs(:post => nil)
|
244
|
-
proxy = stub(:new => real_http)
|
245
|
-
Net::HTTP.stubs(:Proxy => proxy)
|
246
|
-
File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(false)
|
247
|
-
|
248
|
-
send_exception(:secure => true)
|
249
|
-
assert(real_http.use_ssl?)
|
250
|
-
assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
|
251
|
-
assert_equal(Airbrake.configuration.local_cert_path, real_http.ca_file)
|
252
|
-
end
|
253
|
-
|
254
|
-
should "use the default DEFAULT_CERT_FILE if asked to" do
|
255
|
-
config = Airbrake::Configuration.new
|
256
|
-
config.use_system_ssl_cert_chain = true
|
257
|
-
sender = Airbrake::Sender.new(config)
|
258
|
-
|
259
|
-
assert(sender.use_system_ssl_cert_chain?)
|
260
|
-
|
261
|
-
http = sender.send(:setup_http_connection)
|
262
|
-
assert_not_equal http.ca_file, config.local_cert_path
|
263
|
-
end
|
264
|
-
|
265
|
-
should "verify the connection when the use_ssl option is set (VERIFY_PEER)" do
|
266
|
-
sender = build_sender(:secure => true)
|
267
|
-
http = sender.send(:setup_http_connection)
|
268
|
-
assert_equal(OpenSSL::SSL::VERIFY_PEER, http.verify_mode)
|
269
|
-
end
|
270
|
-
|
271
|
-
should "use the default cert (OpenSSL::X509::DEFAULT_CERT_FILE) only if explicitly told to" do
|
272
|
-
sender = build_sender(:secure => true)
|
273
|
-
http = sender.send(:setup_http_connection)
|
274
|
-
|
275
|
-
assert_equal(Airbrake.configuration.local_cert_path, http.ca_file)
|
276
|
-
|
277
|
-
File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
|
278
|
-
sender = build_sender(:secure => true, :use_system_ssl_cert_chain => true)
|
279
|
-
http = sender.send(:setup_http_connection)
|
280
|
-
|
281
|
-
assert_not_equal(Airbrake.configuration.local_cert_path, http.ca_file)
|
282
|
-
assert_equal(OpenSSL::X509::DEFAULT_CERT_FILE, http.ca_file)
|
283
|
-
end
|
284
|
-
|
285
|
-
should "connect to the right port for ssl" do
|
286
|
-
stub_http
|
287
|
-
send_exception(:secure => true)
|
288
|
-
assert_received(Net::HTTP, :new) {|expect| expect.with("api.airbrake.io", 443) }
|
289
|
-
end
|
290
|
-
|
291
|
-
should "connect to the right port for non-ssl" do
|
292
|
-
stub_http
|
293
|
-
send_exception(:secure => false)
|
294
|
-
assert_received(Net::HTTP, :new) {|expect| expect.with("api.airbrake.io", 80) }
|
295
|
-
end
|
296
|
-
|
297
|
-
should "use ssl if secure" do
|
298
|
-
stub_http
|
299
|
-
send_exception(:secure => true, :host => 'example.org')
|
300
|
-
assert_received(Net::HTTP, :new) {|expect| expect.with('example.org', 443) }
|
301
|
-
end
|
302
|
-
|
303
|
-
should "not use ssl if not secure" do
|
304
|
-
stub_http
|
305
|
-
send_exception(:secure => false, :host => 'example.org')
|
306
|
-
assert_received(Net::HTTP, :new) {|expect| expect.with('example.org', 80) }
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
context "network timeouts" do
|
311
|
-
should "default the open timeout to 2 seconds" do
|
312
|
-
http = stub_http
|
313
|
-
send_exception
|
314
|
-
assert_received(http, :open_timeout=) {|expect| expect.with(2) }
|
315
|
-
end
|
316
|
-
|
317
|
-
should "default the read timeout to 5 seconds" do
|
318
|
-
http = stub_http
|
319
|
-
send_exception
|
320
|
-
assert_received(http, :read_timeout=) {|expect| expect.with(5) }
|
321
|
-
end
|
322
|
-
|
323
|
-
should "allow override of the open timeout" do
|
324
|
-
http = stub_http
|
325
|
-
send_exception(:http_open_timeout => 4)
|
326
|
-
assert_received(http, :open_timeout=) {|expect| expect.with(4) }
|
327
|
-
end
|
328
|
-
|
329
|
-
should "allow override of the read timeout" do
|
330
|
-
http = stub_http
|
331
|
-
send_exception(:http_read_timeout => 10)
|
332
|
-
assert_received(http, :read_timeout=) {|expect| expect.with(10) }
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
data/test/user_informer_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.expand_path '../helper', __FILE__
|
2
|
-
|
3
|
-
class UserInformerTest < Test::Unit::TestCase
|
4
|
-
should "modify output if there is an airbrake id" do
|
5
|
-
main_app = lambda do |env|
|
6
|
-
env['airbrake.error_id'] = 1
|
7
|
-
[200, {}, ["<!-- AIRBRAKE ERROR -->"]]
|
8
|
-
end
|
9
|
-
informer_app = Airbrake::UserInformer.new(main_app)
|
10
|
-
|
11
|
-
ShamRack.mount(informer_app, "example.com")
|
12
|
-
|
13
|
-
response = Net::HTTP.get_response(URI.parse("http://example.com/"))
|
14
|
-
assert_equal "Airbrake Error 1", response.body
|
15
|
-
assert_equal 16, response["Content-Length"].to_i
|
16
|
-
end
|
17
|
-
|
18
|
-
should "not modify output if there is no airbrake id" do
|
19
|
-
main_app = lambda do |env|
|
20
|
-
[200, {}, ["<!-- AIRBRAKE ERROR -->"]]
|
21
|
-
end
|
22
|
-
informer_app = Airbrake::UserInformer.new(main_app)
|
23
|
-
|
24
|
-
ShamRack.mount(informer_app, "example.com")
|
25
|
-
|
26
|
-
response = Net::HTTP.get_response(URI.parse("http://example.com/"))
|
27
|
-
assert_equal "<!-- AIRBRAKE ERROR -->", response.body
|
28
|
-
end
|
29
|
-
end
|