raygun4ruby 1.2.1 → 1.3.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/CHANGELOG.md +9 -0
- data/README.md +40 -4
- data/lib/raygun.rb +37 -13
- data/lib/raygun/affected_user.rb +59 -0
- data/lib/raygun/client.rb +23 -5
- data/lib/raygun/configuration.rb +25 -15
- data/lib/raygun/error.rb +10 -0
- data/lib/raygun/middleware/rails_insert_affected_user.rb +7 -12
- data/lib/raygun/version.rb +1 -1
- data/test/unit/{rails_insert_affected_user_test.rb → affected_user_test.rb} +38 -16
- data/test/unit/client_test.rb +126 -316
- data/test/unit/configuration_test.rb +33 -0
- data/test/unit/raygun_test.rb +41 -1
- metadata +6 -4
@@ -2,20 +2,24 @@ require_relative "../test_helper.rb"
|
|
2
2
|
require 'ostruct'
|
3
3
|
require 'raygun/middleware/rails_insert_affected_user'
|
4
4
|
|
5
|
-
class
|
5
|
+
class AffectedUserTest < Raygun::UnitTest
|
6
6
|
|
7
7
|
class TestException < StandardError; end
|
8
8
|
|
9
9
|
class MockController
|
10
10
|
|
11
11
|
def user_with_email
|
12
|
-
OpenStruct.new(email: "testemail@something.com")
|
12
|
+
OpenStruct.new(id: 123, email: "testemail@something.com")
|
13
13
|
end
|
14
14
|
|
15
15
|
def user_with_login
|
16
16
|
OpenStruct.new(login: "topsecret")
|
17
17
|
end
|
18
18
|
|
19
|
+
def user_with_full_details
|
20
|
+
OpenStruct.new(id: 123, email: "testemail@something.com", first_name: "Taylor", last_name: "Lodge")
|
21
|
+
end
|
22
|
+
|
19
23
|
def user_as_string
|
20
24
|
"some-string-identifier"
|
21
25
|
end
|
@@ -56,22 +60,24 @@ class ClientTest < Raygun::UnitTest
|
|
56
60
|
|
57
61
|
begin
|
58
62
|
@middleware.call("action_controller.instance" => @controller)
|
59
|
-
rescue TestException
|
60
|
-
user_hash = { :
|
63
|
+
rescue TestException
|
64
|
+
user_hash = { :Identifier => 123, :Email => "testemail@something.com", :IsAnonymous => false }
|
61
65
|
assert_equal user_hash, @app.env["raygun.affected_user"]
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
65
|
-
def
|
69
|
+
def test_changing_method_mapping
|
66
70
|
Raygun.configuration.affected_user_method = :user_with_login
|
67
|
-
Raygun.configuration.
|
68
|
-
|
71
|
+
Raygun.configuration.affected_user_mapping = {
|
72
|
+
identifier: :login
|
73
|
+
}
|
74
|
+
|
69
75
|
assert @controller.respond_to?(Raygun.configuration.affected_user_method)
|
70
76
|
|
71
77
|
begin
|
72
78
|
@middleware.call("action_controller.instance" => @controller)
|
73
|
-
rescue TestException
|
74
|
-
user_hash = { :
|
79
|
+
rescue TestException
|
80
|
+
user_hash = { :Identifier => "topsecret", :IsAnonymous => false }
|
75
81
|
assert_equal user_hash, @app.env["raygun.affected_user"]
|
76
82
|
end
|
77
83
|
end
|
@@ -82,8 +88,8 @@ class ClientTest < Raygun::UnitTest
|
|
82
88
|
|
83
89
|
begin
|
84
90
|
@middleware.call("action_controller.instance" => @controller)
|
85
|
-
rescue TestException
|
86
|
-
user_hash = { :
|
91
|
+
rescue TestException
|
92
|
+
user_hash = { :Identifier => "some-string-identifier", :IsAnonymous => true }
|
87
93
|
assert_equal user_hash, @app.env["raygun.affected_user"]
|
88
94
|
end
|
89
95
|
end
|
@@ -94,8 +100,9 @@ class ClientTest < Raygun::UnitTest
|
|
94
100
|
|
95
101
|
begin
|
96
102
|
@middleware.call("action_controller.instance" => @controller)
|
97
|
-
rescue TestException
|
98
|
-
|
103
|
+
rescue TestException
|
104
|
+
user_hash = { :IsAnonymous => true }
|
105
|
+
assert_equal user_hash, @app.env["raygun.affected_user"]
|
99
106
|
end
|
100
107
|
end
|
101
108
|
|
@@ -105,10 +112,25 @@ class ClientTest < Raygun::UnitTest
|
|
105
112
|
|
106
113
|
begin
|
107
114
|
@middleware.call("action_controller.instance" => @controller)
|
108
|
-
rescue TestException
|
109
|
-
user_hash = { :
|
115
|
+
rescue TestException
|
116
|
+
user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com"}
|
110
117
|
assert_equal user_hash, @app.env["raygun.affected_user"]
|
111
118
|
end
|
112
119
|
end
|
113
120
|
|
114
|
-
|
121
|
+
def test_with_proc_for_mapping
|
122
|
+
Raygun.configuration.affected_user_method = :user_with_full_details
|
123
|
+
Raygun.configuration.affected_user_mapping = Raygun::AffectedUser::DEFAULT_MAPPING.merge({
|
124
|
+
full_name: ->(user) { "#{user.first_name} #{user.last_name}" }
|
125
|
+
})
|
126
|
+
|
127
|
+
assert @controller.respond_to?(Raygun.configuration.affected_user_method, true)
|
128
|
+
|
129
|
+
begin
|
130
|
+
@middleware.call("action_controller.instance" => @controller)
|
131
|
+
rescue TestException
|
132
|
+
user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com", :FullName => "Taylor Lodge", :FirstName => "Taylor"}
|
133
|
+
assert_equal user_hash, @app.env["raygun.affected_user"]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
data/test/unit/client_test.rb
CHANGED
@@ -4,7 +4,12 @@ require 'stringio'
|
|
4
4
|
|
5
5
|
class ClientTest < Raygun::UnitTest
|
6
6
|
|
7
|
-
class TestException < StandardError
|
7
|
+
class TestException < StandardError
|
8
|
+
def initialize(message = nil)
|
9
|
+
super(message || "A test message")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
8
13
|
class NilMessageError < StandardError
|
9
14
|
def message
|
10
15
|
nil
|
@@ -43,20 +48,7 @@ class ClientTest < Raygun::UnitTest
|
|
43
48
|
end
|
44
49
|
|
45
50
|
def test_error_details
|
46
|
-
|
47
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
48
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
49
|
-
|
50
|
-
expected_hash = {
|
51
|
-
className: "ClientTest::TestException",
|
52
|
-
message: e.message,
|
53
|
-
stackTrace: [
|
54
|
-
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
55
|
-
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run"}
|
56
|
-
]
|
57
|
-
}
|
58
|
-
|
59
|
-
assert_equal expected_hash, @client.send(:error_details, e)
|
51
|
+
assert_equal exception_hash, @client.send(:error_details, test_exception)
|
60
52
|
end
|
61
53
|
|
62
54
|
def test_error_details_with_nil_message
|
@@ -85,11 +77,10 @@ class ClientTest < Raygun::UnitTest
|
|
85
77
|
end
|
86
78
|
|
87
79
|
def test_affected_user
|
88
|
-
e = TestException.new("A test message")
|
89
80
|
test_env = { "raygun.affected_user" => { :identifier => "somepooruser@yourapp.com" } }
|
90
81
|
expected_hash = test_env["raygun.affected_user"]
|
91
82
|
|
92
|
-
assert_equal expected_hash, @client.send(:build_payload_hash,
|
83
|
+
assert_equal expected_hash, @client.send(:build_payload_hash, test_exception, test_env)[:details][:user]
|
93
84
|
end
|
94
85
|
|
95
86
|
def test_tags
|
@@ -101,11 +92,10 @@ class ClientTest < Raygun::UnitTest
|
|
101
92
|
config.tags = configuration_tags
|
102
93
|
end
|
103
94
|
|
104
|
-
e = TestException.new("A test message")
|
105
95
|
test_env = { tags: explicit_env_tags }
|
106
96
|
expected_tags = configuration_tags + explicit_env_tags + rack_env_tag
|
107
97
|
|
108
|
-
assert_equal expected_tags, @client.send(:build_payload_hash,
|
98
|
+
assert_equal expected_tags, @client.send(:build_payload_hash, test_exception, test_env)[:details][:tags]
|
109
99
|
end
|
110
100
|
|
111
101
|
def test_hostname
|
@@ -141,10 +131,6 @@ class ClientTest < Raygun::UnitTest
|
|
141
131
|
def test_full_payload_hash
|
142
132
|
Timecop.freeze do
|
143
133
|
Raygun.configuration.version = 123
|
144
|
-
e = TestException.new("A test message")
|
145
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
146
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
147
|
-
|
148
134
|
grouping_key = "my custom group"
|
149
135
|
|
150
136
|
expected_hash = {
|
@@ -157,14 +143,7 @@ class ClientTest < Raygun::UnitTest
|
|
157
143
|
version: Raygun::VERSION,
|
158
144
|
clientUrl: Raygun::CLIENT_URL
|
159
145
|
},
|
160
|
-
error:
|
161
|
-
className: "ClientTest::TestException",
|
162
|
-
message: e.message,
|
163
|
-
stackTrace: [
|
164
|
-
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
165
|
-
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run"}
|
166
|
-
]
|
167
|
-
},
|
146
|
+
error: exception_hash,
|
168
147
|
userCustomData: {},
|
169
148
|
tags: ["test"],
|
170
149
|
request: {},
|
@@ -172,33 +151,15 @@ class ClientTest < Raygun::UnitTest
|
|
172
151
|
}
|
173
152
|
}
|
174
153
|
|
175
|
-
assert_equal expected_hash, @client.send(:build_payload_hash,
|
154
|
+
assert_equal expected_hash, @client.send(:build_payload_hash, test_exception, { grouping_key: grouping_key })
|
176
155
|
end
|
177
156
|
end
|
178
157
|
|
179
158
|
def test_getting_request_information
|
180
|
-
|
181
|
-
"SERVER_NAME"=>"localhost",
|
182
|
-
"REQUEST_METHOD"=>"GET",
|
183
|
-
"REQUEST_PATH"=>"/",
|
184
|
-
"PATH_INFO"=>"/",
|
159
|
+
env_hash = sample_env_hash.merge({
|
185
160
|
"QUERY_STRING"=>"a=b&c=4945438",
|
186
161
|
"REQUEST_URI"=>"/?a=b&c=4945438",
|
187
|
-
|
188
|
-
"HTTP_HOST"=>"localhost:3000",
|
189
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
190
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
191
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
192
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
193
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
194
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
195
|
-
"HTTP_COOKIE"=>"cookieval",
|
196
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
197
|
-
"SERVER_PORT"=>"3000",
|
198
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
199
|
-
"SCRIPT_NAME"=>"",
|
200
|
-
"REMOTE_ADDR"=>"127.0.0.1"
|
201
|
-
}
|
162
|
+
})
|
202
163
|
|
203
164
|
expected_hash = {
|
204
165
|
hostName: "localhost",
|
@@ -206,12 +167,12 @@ class ClientTest < Raygun::UnitTest
|
|
206
167
|
httpMethod: "GET",
|
207
168
|
iPAddress: "127.0.0.1",
|
208
169
|
queryString: { "a" => "b", "c" => "4945438" },
|
209
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
170
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
210
171
|
form: {},
|
211
172
|
rawData: {}
|
212
173
|
}
|
213
174
|
|
214
|
-
assert_equal expected_hash, @client.send(:request_information,
|
175
|
+
assert_equal expected_hash, @client.send(:request_information, env_hash)
|
215
176
|
end
|
216
177
|
|
217
178
|
def test_getting_request_information_with_nil_env
|
@@ -219,37 +180,47 @@ class ClientTest < Raygun::UnitTest
|
|
219
180
|
end
|
220
181
|
|
221
182
|
def test_non_form_parameters
|
222
|
-
put_body_env_hash = {
|
223
|
-
"SERVER_NAME"=>"localhost",
|
183
|
+
put_body_env_hash = sample_env_hash.merge({
|
224
184
|
"REQUEST_METHOD"=>"PUT",
|
225
|
-
"REQUEST_PATH"=>"/",
|
226
|
-
"PATH_INFO"=>"/",
|
227
|
-
"QUERY_STRING"=>"",
|
228
|
-
"REQUEST_URI"=>"/",
|
229
|
-
"HTTP_VERSION"=>"HTTP/1.1",
|
230
|
-
"HTTP_HOST"=>"localhost:3000",
|
231
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
232
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
233
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
234
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
235
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
236
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
237
|
-
"HTTP_COOKIE"=>"cookieval",
|
238
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
239
|
-
"SERVER_PORT"=>"3000",
|
240
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
241
|
-
"SCRIPT_NAME"=>"",
|
242
|
-
"REMOTE_ADDR"=>"127.0.0.1",
|
243
185
|
"action_dispatch.request.parameters"=> { "a" => "b", "c" => "4945438", "password" => "swordfish" }
|
244
|
-
}
|
186
|
+
})
|
245
187
|
|
246
188
|
expected_form_hash = { "a" => "b", "c" => "4945438", "password" => "[FILTERED]" }
|
247
189
|
|
248
190
|
assert_equal expected_form_hash, @client.send(:request_information, put_body_env_hash)[:rawData]
|
249
191
|
end
|
250
192
|
|
193
|
+
def test_error_raygun_custom_data
|
194
|
+
custom_data = { "kappa" => "keepo" }
|
195
|
+
e = Raygun::Error.new("A test message", custom_data)
|
196
|
+
test_env = {}
|
197
|
+
expected_form_hash = test_env.merge(custom_data)
|
198
|
+
|
199
|
+
assert_equal expected_form_hash, @client.send(:build_payload_hash, e, test_env)[:details][:userCustomData]
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_custom_data_configuration_with_hash
|
203
|
+
custom_data = {foo: '123'}
|
204
|
+
Raygun.configuration.custom_data = custom_data
|
205
|
+
|
206
|
+
assert_equal custom_data, @client.send(:build_payload_hash, test_exception, sample_env_hash)[:details][:userCustomData]
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_custom_data_configuration_with_proc
|
210
|
+
Raygun.configuration.custom_data do |exception, env|
|
211
|
+
{exception_message: exception.message, server_name: env["SERVER_NAME"]}
|
212
|
+
end
|
213
|
+
expected = {
|
214
|
+
exception_message: "A test message",
|
215
|
+
server_name: "localhost"
|
216
|
+
}
|
217
|
+
|
218
|
+
assert_equal expected, @client.send(:build_payload_hash, test_exception, sample_env_hash)[:details][:userCustomData]
|
219
|
+
end
|
220
|
+
|
251
221
|
def test_filtering_parameters
|
252
222
|
post_body_env_hash = sample_env_hash.merge(
|
223
|
+
"REQUEST_METHOD" => "POST",
|
253
224
|
"rack.input"=>StringIO.new("a=b&c=4945438&password=swordfish")
|
254
225
|
)
|
255
226
|
|
@@ -260,6 +231,7 @@ class ClientTest < Raygun::UnitTest
|
|
260
231
|
|
261
232
|
def test_filtering_nested_params
|
262
233
|
post_body_env_hash = sample_env_hash.merge(
|
234
|
+
"REQUEST_METHOD" => "POST",
|
263
235
|
"rack.input" => StringIO.new("a=b&bank%5Bcredit_card%5D%5Bcard_number%5D=my_secret_bank_number&bank%5Bname%5D=something&c=123456&user%5Bpassword%5D=my_fancy_password")
|
264
236
|
)
|
265
237
|
|
@@ -282,6 +254,7 @@ class ClientTest < Raygun::UnitTest
|
|
282
254
|
end
|
283
255
|
|
284
256
|
post_body_env_hash = sample_env_hash.merge(
|
257
|
+
"REQUEST_METHOD" => "POST",
|
285
258
|
"rack.input" => StringIO.new("nsa_only_info=123&nsa_only_metadata=seekrit&something_normal=hello")
|
286
259
|
)
|
287
260
|
|
@@ -311,6 +284,7 @@ class ClientTest < Raygun::UnitTest
|
|
311
284
|
}
|
312
285
|
|
313
286
|
post_body_env_hash = sample_env_hash.merge(
|
287
|
+
"REQUEST_METHOD" => "POST",
|
314
288
|
"rack.input" => StringIO.new(URI.encode_www_form(parameters))
|
315
289
|
)
|
316
290
|
|
@@ -320,93 +294,38 @@ class ClientTest < Raygun::UnitTest
|
|
320
294
|
end
|
321
295
|
|
322
296
|
def test_ip_address_from_action_dispatch
|
323
|
-
|
324
|
-
"HTTP_VERSION"=>"HTTP/1.1",
|
325
|
-
"HTTP_HOST"=>"localhost:3000",
|
326
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
327
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
328
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
329
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
330
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
331
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
332
|
-
"HTTP_COOKIE"=>"cookieval",
|
333
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
334
|
-
"SERVER_PORT"=>"3000",
|
335
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
336
|
-
"SCRIPT_NAME"=>"",
|
337
|
-
"REMOTE_ADDR"=>"127.0.0.1",
|
297
|
+
env_hash = sample_env_hash.merge({
|
338
298
|
"action_dispatch.remote_ip"=> "123.456.789.012"
|
339
|
-
}
|
299
|
+
})
|
340
300
|
|
341
|
-
assert_equal "123.456.789.012", @client.send(:ip_address_from,
|
342
|
-
assert_equal "123.456.789.012", @client.send(:request_information,
|
301
|
+
assert_equal "123.456.789.012", @client.send(:ip_address_from, env_hash)
|
302
|
+
assert_equal "123.456.789.012", @client.send(:request_information, env_hash)[:iPAddress]
|
343
303
|
end
|
344
304
|
|
345
305
|
def test_ip_address_from_old_action_dispatch
|
346
306
|
old_action_dispatch_ip = FakeActionDispatcherIp.new("123.456.789.012")
|
347
|
-
|
348
|
-
"HTTP_VERSION"=>"HTTP/1.1",
|
349
|
-
"HTTP_HOST"=>"localhost:3000",
|
350
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
351
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
352
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
353
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
354
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
355
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
356
|
-
"HTTP_COOKIE"=>"cookieval",
|
357
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
358
|
-
"SERVER_PORT"=>"3000",
|
359
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
360
|
-
"SCRIPT_NAME"=>"",
|
361
|
-
"REMOTE_ADDR"=>"127.0.0.1",
|
307
|
+
env_hash = sample_env_hash.merge({
|
362
308
|
"action_dispatch.remote_ip"=> old_action_dispatch_ip
|
363
|
-
}
|
309
|
+
})
|
364
310
|
|
365
|
-
assert_equal old_action_dispatch_ip, @client.send(:ip_address_from,
|
366
|
-
assert_equal "123.456.789.012", @client.send(:request_information,
|
311
|
+
assert_equal old_action_dispatch_ip, @client.send(:ip_address_from, env_hash)
|
312
|
+
assert_equal "123.456.789.012", @client.send(:request_information, env_hash)[:iPAddress]
|
367
313
|
end
|
368
314
|
|
369
315
|
def test_ip_address_from_raygun_specific_key
|
370
|
-
|
371
|
-
"HTTP_VERSION"=>"HTTP/1.1",
|
372
|
-
"HTTP_HOST"=>"localhost:3000",
|
373
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
374
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
375
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
376
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
377
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
378
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
379
|
-
"HTTP_COOKIE"=>"cookieval",
|
380
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
381
|
-
"SERVER_PORT"=>"3000",
|
382
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
383
|
-
"SCRIPT_NAME"=>"",
|
384
|
-
"REMOTE_ADDR"=>"127.0.0.1",
|
316
|
+
env_hash = sample_env_hash.merge({
|
385
317
|
"raygun.remote_ip"=>"123.456.789.012"
|
386
|
-
}
|
318
|
+
})
|
387
319
|
|
388
|
-
assert_equal "123.456.789.012", @client.send(:ip_address_from,
|
389
|
-
assert_equal "123.456.789.012", @client.send(:request_information,
|
320
|
+
assert_equal "123.456.789.012", @client.send(:ip_address_from, env_hash)
|
321
|
+
assert_equal "123.456.789.012", @client.send(:request_information, env_hash)[:iPAddress]
|
390
322
|
end
|
391
323
|
|
392
324
|
def test_ip_address_returns_not_available_if_not_set
|
393
|
-
|
394
|
-
|
395
|
-
"HTTP_HOST"=>"localhost:3000",
|
396
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
397
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
398
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
399
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
400
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
401
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
402
|
-
"HTTP_COOKIE"=>"cookieval",
|
403
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
404
|
-
"SERVER_PORT"=>"3000",
|
405
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
406
|
-
"SCRIPT_NAME"=>""
|
407
|
-
}
|
325
|
+
env_hash = sample_env_hash.dup
|
326
|
+
env_hash.delete("REMOTE_ADDR")
|
408
327
|
|
409
|
-
assert_equal "(Not Available)", @client.send(:ip_address_from,
|
328
|
+
assert_equal "(Not Available)", @client.send(:ip_address_from, env_hash)
|
410
329
|
end
|
411
330
|
|
412
331
|
def test_setting_up_http_proxy
|
@@ -427,11 +346,7 @@ class ClientTest < Raygun::UnitTest
|
|
427
346
|
Raygun.configuration.filter_payload_with_whitelist = true
|
428
347
|
Raygun.configuration.whitelist_payload_shape = {}
|
429
348
|
|
430
|
-
e =
|
431
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
432
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
433
|
-
|
434
|
-
client_details = @client.send(:client_details)
|
349
|
+
e = test_exception
|
435
350
|
|
436
351
|
assert_equal Time.now.utc.iso8601, @client.send(:build_payload_hash, e)[:occurredOn]
|
437
352
|
assert_equal Hash, @client.send(:build_payload_hash, e)[:details].class
|
@@ -442,34 +357,17 @@ class ClientTest < Raygun::UnitTest
|
|
442
357
|
Raygun.configuration.filter_payload_with_whitelist = true
|
443
358
|
Raygun.configuration.whitelist_payload_shape = {}
|
444
359
|
|
445
|
-
e = TestException.new("A test message")
|
446
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
447
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
448
|
-
|
449
360
|
client_details = @client.send(:client_details)
|
450
361
|
|
451
|
-
assert_equal client_details, @client.send(:build_payload_hash,
|
362
|
+
assert_equal client_details, @client.send(:build_payload_hash, test_exception)[:details][:client]
|
452
363
|
end
|
453
364
|
|
454
365
|
def test_filter_payload_with_whitelist_default_error
|
455
366
|
Raygun.configuration.filter_payload_with_whitelist = true
|
456
367
|
|
457
|
-
|
458
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
459
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
460
|
-
|
461
|
-
details = @client.send(:build_payload_hash, e)[:details]
|
368
|
+
details = @client.send(:build_payload_hash, test_exception)[:details]
|
462
369
|
|
463
|
-
|
464
|
-
className: "ClientTest::TestException",
|
465
|
-
message: e.message,
|
466
|
-
stackTrace: [
|
467
|
-
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
468
|
-
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run" }
|
469
|
-
]
|
470
|
-
}
|
471
|
-
|
472
|
-
assert_equal expected_hash, details[:error]
|
370
|
+
assert_equal exception_hash, details[:error]
|
473
371
|
end
|
474
372
|
|
475
373
|
def test_filter_payload_with_whitelist_exclude_error_keys
|
@@ -482,22 +380,9 @@ class ClientTest < Raygun::UnitTest
|
|
482
380
|
}
|
483
381
|
}
|
484
382
|
|
485
|
-
|
486
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
487
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
488
|
-
|
489
|
-
details = @client.send(:build_payload_hash, e)[:details]
|
490
|
-
|
491
|
-
expected_hash = {
|
492
|
-
className: "ClientTest::TestException",
|
493
|
-
message: e.message,
|
494
|
-
stackTrace: [
|
495
|
-
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
496
|
-
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run" }
|
497
|
-
]
|
498
|
-
}
|
383
|
+
details = @client.send(:build_payload_hash, test_exception)[:details]
|
499
384
|
|
500
|
-
assert_equal
|
385
|
+
assert_equal exception_hash, details[:error]
|
501
386
|
end
|
502
387
|
|
503
388
|
def test_filter_payload_with_whitelist_exclude_error_except_stacktrace
|
@@ -509,17 +394,11 @@ class ClientTest < Raygun::UnitTest
|
|
509
394
|
}
|
510
395
|
}
|
511
396
|
|
512
|
-
|
513
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
514
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
515
|
-
|
516
|
-
details = @client.send(:build_payload_hash, e)[:details]
|
397
|
+
details = @client.send(:build_payload_hash, test_exception)[:details]
|
517
398
|
|
518
|
-
expected_hash = {
|
519
|
-
className: "ClientTest::TestException",
|
520
|
-
message: "A test message",
|
399
|
+
expected_hash = exception_hash.merge({
|
521
400
|
stackTrace: "[FILTERED]"
|
522
|
-
}
|
401
|
+
})
|
523
402
|
|
524
403
|
assert_equal expected_hash, details[:error]
|
525
404
|
end
|
@@ -530,36 +409,20 @@ class ClientTest < Raygun::UnitTest
|
|
530
409
|
payload
|
531
410
|
end
|
532
411
|
|
533
|
-
|
534
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
535
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
412
|
+
details = @client.send(:build_payload_hash, test_exception)[:details]
|
536
413
|
|
537
|
-
|
538
|
-
|
539
|
-
expected_hash = {
|
540
|
-
className: "ClientTest::TestException",
|
541
|
-
message: "A test message",
|
542
|
-
stackTrace: [
|
543
|
-
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
544
|
-
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run" }
|
545
|
-
]
|
546
|
-
}
|
547
|
-
|
548
|
-
assert_equal expected_hash, details[:error]
|
414
|
+
assert_equal exception_hash, details[:error]
|
549
415
|
end
|
550
416
|
|
551
417
|
def test_filter_payload_with_whitelist_default_request_post
|
552
418
|
Raygun.configuration.filter_payload_with_whitelist = true
|
553
419
|
|
554
|
-
e = TestException.new("A test message")
|
555
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
556
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
557
|
-
|
558
420
|
post_body_env_hash = sample_env_hash.merge(
|
421
|
+
"REQUEST_METHOD" => "POST",
|
559
422
|
"rack.input"=>StringIO.new("a=b&c=4945438&password=swordfish")
|
560
423
|
)
|
561
424
|
|
562
|
-
details = @client.send(:build_payload_hash,
|
425
|
+
details = @client.send(:build_payload_hash, test_exception, post_body_env_hash)[:details]
|
563
426
|
|
564
427
|
expected_hash = {
|
565
428
|
hostName: "localhost",
|
@@ -567,7 +430,7 @@ class ClientTest < Raygun::UnitTest
|
|
567
430
|
httpMethod: "POST",
|
568
431
|
iPAddress: "127.0.0.1",
|
569
432
|
queryString: { },
|
570
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
433
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
571
434
|
form: { "a" => "[FILTERED]", "c" => "[FILTERED]", "password" => "[FILTERED]" },
|
572
435
|
rawData: nil
|
573
436
|
}
|
@@ -585,15 +448,12 @@ class ClientTest < Raygun::UnitTest
|
|
585
448
|
)
|
586
449
|
Raygun.configuration.whitelist_payload_shape = shape
|
587
450
|
|
588
|
-
e = TestException.new("A test message")
|
589
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
590
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
591
|
-
|
592
451
|
post_body_env_hash = sample_env_hash.merge(
|
452
|
+
"REQUEST_METHOD" => "POST",
|
593
453
|
"rack.input"=>StringIO.new("username=foo&password=swordfish")
|
594
454
|
)
|
595
455
|
|
596
|
-
details = @client.send(:build_payload_hash,
|
456
|
+
details = @client.send(:build_payload_hash, test_exception, post_body_env_hash)[:details]
|
597
457
|
|
598
458
|
expected_hash = {
|
599
459
|
hostName: "localhost",
|
@@ -601,7 +461,7 @@ class ClientTest < Raygun::UnitTest
|
|
601
461
|
httpMethod: "POST",
|
602
462
|
iPAddress: "127.0.0.1",
|
603
463
|
queryString: { },
|
604
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
464
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
605
465
|
form: { "username" => "foo", "password" => "[FILTERED]" },
|
606
466
|
rawData: nil
|
607
467
|
}
|
@@ -612,45 +472,22 @@ class ClientTest < Raygun::UnitTest
|
|
612
472
|
def test_filter_payload_with_whitelist_default_request_get
|
613
473
|
Raygun.configuration.filter_payload_with_whitelist = true
|
614
474
|
|
615
|
-
|
616
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
617
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
618
|
-
|
619
|
-
sample_env_hash = {
|
620
|
-
"SERVER_NAME"=>"localhost",
|
621
|
-
"REQUEST_METHOD"=>"GET",
|
622
|
-
"REQUEST_PATH"=>"/",
|
623
|
-
"PATH_INFO"=>"/",
|
475
|
+
env_hash = sample_env_hash.merge({
|
624
476
|
"QUERY_STRING"=>"a=b&c=4945438",
|
625
477
|
"REQUEST_URI"=>"/?a=b&c=4945438",
|
626
|
-
|
627
|
-
"HTTP_HOST"=>"localhost:3000",
|
628
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
629
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
630
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
631
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
632
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
633
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
634
|
-
"HTTP_COOKIE"=>"cookieval",
|
635
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
636
|
-
"SERVER_PORT"=>"3000",
|
637
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
638
|
-
"SCRIPT_NAME"=>"",
|
639
|
-
"REMOTE_ADDR"=>"127.0.0.1"
|
640
|
-
}
|
641
|
-
|
478
|
+
})
|
642
479
|
expected_hash = {
|
643
480
|
hostName: "localhost",
|
644
481
|
url: "/",
|
645
482
|
httpMethod: "GET",
|
646
483
|
iPAddress: "127.0.0.1",
|
647
484
|
queryString: { "a" => "b", "c" => "4945438" },
|
648
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
485
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
649
486
|
form: {},
|
650
487
|
rawData: {}
|
651
488
|
}
|
652
489
|
|
653
|
-
details = @client.send(:build_payload_hash,
|
490
|
+
details = @client.send(:build_payload_hash, test_exception, env_hash)[:details]
|
654
491
|
|
655
492
|
assert_equal expected_hash, details[:request]
|
656
493
|
end
|
@@ -663,90 +500,41 @@ class ClientTest < Raygun::UnitTest
|
|
663
500
|
end
|
664
501
|
Raygun.configuration.whitelist_payload_shape = shape
|
665
502
|
|
666
|
-
e = TestException.new("A test message")
|
667
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
668
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
669
|
-
|
670
|
-
sample_env_hash = {
|
671
|
-
"SERVER_NAME"=>"localhost",
|
672
|
-
"REQUEST_METHOD"=>"GET",
|
673
|
-
"REQUEST_PATH"=>"/",
|
674
|
-
"PATH_INFO"=>"/",
|
675
|
-
"QUERY_STRING"=>"a=b&c=4945438",
|
676
|
-
"REQUEST_URI"=>"/?a=b&c=4945438",
|
677
|
-
"HTTP_VERSION"=>"HTTP/1.1",
|
678
|
-
"HTTP_HOST"=>"localhost:3000",
|
679
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
680
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
681
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
682
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
683
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
684
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
685
|
-
"HTTP_COOKIE"=>"cookieval",
|
686
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
687
|
-
"SERVER_PORT"=>"3000",
|
688
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
689
|
-
"SCRIPT_NAME"=>"",
|
690
|
-
"REMOTE_ADDR"=>"127.0.0.1"
|
691
|
-
}
|
692
|
-
|
693
503
|
expected_hash = {
|
694
504
|
hostName: "localhost",
|
695
505
|
url: "/",
|
696
506
|
httpMethod: "GET",
|
697
507
|
iPAddress: "127.0.0.1",
|
698
508
|
queryString: "[FILTERED]",
|
699
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
509
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
700
510
|
form: {},
|
701
511
|
rawData: {}
|
702
512
|
}
|
703
513
|
|
704
|
-
details = @client.send(:build_payload_hash,
|
514
|
+
details = @client.send(:build_payload_hash, test_exception, sample_env_hash)[:details]
|
705
515
|
|
706
516
|
assert_equal expected_hash, details[:request]
|
707
517
|
end
|
708
518
|
|
709
519
|
def test_filter_payload_with_whitelist_being_false_does_not_filter_query_string
|
710
520
|
Raygun.configuration.filter_payload_with_whitelist = false
|
711
|
-
e = TestException.new("A test message")
|
712
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
713
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
714
521
|
|
715
|
-
|
716
|
-
"SERVER_NAME"=>"localhost",
|
717
|
-
"REQUEST_METHOD"=>"GET",
|
718
|
-
"REQUEST_PATH"=>"/",
|
719
|
-
"PATH_INFO"=>"/",
|
522
|
+
env_hash = sample_env_hash.merge({
|
720
523
|
"QUERY_STRING"=>"a=b&c=4945438",
|
721
524
|
"REQUEST_URI"=>"/?a=b&c=4945438",
|
722
|
-
|
723
|
-
"HTTP_HOST"=>"localhost:3000",
|
724
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
725
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
726
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
727
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
728
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
729
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
730
|
-
"HTTP_COOKIE"=>"cookieval",
|
731
|
-
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
732
|
-
"SERVER_PORT"=>"3000",
|
733
|
-
"SERVER_PROTOCOL"=>"HTTP/1.1",
|
734
|
-
"SCRIPT_NAME"=>"",
|
735
|
-
"REMOTE_ADDR"=>"127.0.0.1"
|
736
|
-
}
|
737
|
-
|
525
|
+
})
|
738
526
|
expected_hash = {
|
739
527
|
hostName: "localhost",
|
740
528
|
url: "/",
|
741
529
|
httpMethod: "GET",
|
742
530
|
iPAddress: "127.0.0.1",
|
743
531
|
queryString: { "a" => "b", "c" => "4945438" },
|
744
|
-
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "
|
532
|
+
headers: { "Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Cookie"=>"cookieval" },
|
745
533
|
form: {},
|
746
534
|
rawData: {}
|
747
535
|
}
|
748
536
|
|
749
|
-
details = @client.send(:build_payload_hash,
|
537
|
+
details = @client.send(:build_payload_hash, test_exception, env_hash)[:details]
|
750
538
|
|
751
539
|
assert_equal expected_hash, details[:request]
|
752
540
|
end
|
@@ -761,16 +549,12 @@ class ClientTest < Raygun::UnitTest
|
|
761
549
|
}
|
762
550
|
}
|
763
551
|
|
764
|
-
|
765
|
-
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
766
|
-
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
767
|
-
|
768
|
-
details = @client.send(:build_payload_hash, e, sample_env_hash)[:details]
|
552
|
+
details = @client.send(:build_payload_hash, test_exception, sample_env_hash)[:details]
|
769
553
|
|
770
554
|
expected_hash = {
|
771
555
|
hostName: "localhost",
|
772
556
|
url: "/",
|
773
|
-
httpMethod: "
|
557
|
+
httpMethod: "GET",
|
774
558
|
iPAddress: "[FILTERED]",
|
775
559
|
queryString: "[FILTERED]",
|
776
560
|
headers: "[FILTERED]",
|
@@ -781,25 +565,51 @@ class ClientTest < Raygun::UnitTest
|
|
781
565
|
assert_equal expected_hash, details[:request]
|
782
566
|
end
|
783
567
|
|
568
|
+
def test_build_payload_hash_adds_affected_user_details_when_supplied_with_user
|
569
|
+
user = OpenStruct.new(id: '123', email: 'test@email.com', first_name: 'Taylor')
|
570
|
+
expected_details = {
|
571
|
+
:IsAnonymous => false,
|
572
|
+
:Identifier => '123',
|
573
|
+
:Email => 'test@email.com',
|
574
|
+
:FirstName => 'Taylor',
|
575
|
+
}
|
576
|
+
|
577
|
+
user_details = @client.send(:build_payload_hash, test_exception, sample_env_hash, user)[:details][:user]
|
578
|
+
|
579
|
+
assert_equal expected_details, user_details
|
580
|
+
end
|
784
581
|
|
785
582
|
private
|
786
583
|
|
584
|
+
def test_exception
|
585
|
+
e = TestException.new
|
586
|
+
e.set_backtrace(["/some/folder/some_file.rb:123:in `some_method_name'",
|
587
|
+
"/another/path/foo.rb:1234:in `block (3 levels) run'"])
|
588
|
+
|
589
|
+
e
|
590
|
+
end
|
591
|
+
|
592
|
+
def exception_hash
|
593
|
+
{
|
594
|
+
className: "ClientTest::TestException",
|
595
|
+
message: "A test message",
|
596
|
+
stackTrace: [
|
597
|
+
{ lineNumber: "123", fileName: "/some/folder/some_file.rb", methodName: "some_method_name" },
|
598
|
+
{ lineNumber: "1234", fileName: "/another/path/foo.rb", methodName: "block (3 levels) run"}
|
599
|
+
]
|
600
|
+
}
|
601
|
+
end
|
602
|
+
|
787
603
|
def sample_env_hash
|
788
604
|
{
|
789
605
|
"SERVER_NAME"=>"localhost",
|
790
|
-
"REQUEST_METHOD"=>"
|
606
|
+
"REQUEST_METHOD"=>"GET",
|
791
607
|
"REQUEST_PATH"=>"/",
|
792
608
|
"PATH_INFO"=>"/",
|
793
609
|
"QUERY_STRING"=>"",
|
794
610
|
"REQUEST_URI"=>"/",
|
795
611
|
"HTTP_VERSION"=>"HTTP/1.1",
|
796
612
|
"HTTP_HOST"=>"localhost:3000",
|
797
|
-
"HTTP_CONNECTION"=>"keep-alive",
|
798
|
-
"HTTP_CACHE_CONTROL"=>"max-age=0",
|
799
|
-
"HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
800
|
-
"HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.22 Safari/537.36",
|
801
|
-
"HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch",
|
802
|
-
"HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8",
|
803
613
|
"HTTP_COOKIE"=>"cookieval",
|
804
614
|
"GATEWAY_INTERFACE"=>"CGI/1.2",
|
805
615
|
"SERVER_PORT"=>"3000",
|