exception_notification 4.6.0 → 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/CHANGELOG.rdoc +16 -0
- data/CONTRIBUTING.md +23 -51
- data/Gemfile +1 -1
- data/Gemfile.lock +27 -33
- data/README.md +65 -31
- data/Rakefile +14 -7
- data/exception_notification.gemspec +27 -30
- data/gemfiles/pinned_dependencies.gemfile +8 -0
- data/gemfiles/rails7_1.gemfile +5 -0
- data/gemfiles/rails7_2.gemfile +5 -0
- data/gemfiles/rails8_0.gemfile +5 -0
- data/lib/exception_notification/rack.rb +4 -4
- data/lib/exception_notification/rails.rb +2 -2
- data/lib/exception_notification/rake.rb +3 -7
- data/lib/exception_notification/resque.rb +2 -2
- data/lib/exception_notification/sidekiq.rb +8 -23
- data/lib/exception_notification/version.rb +1 -1
- data/lib/exception_notification.rb +3 -3
- data/lib/exception_notifier/datadog_notifier.rb +26 -26
- data/lib/exception_notifier/email_notifier.rb +34 -30
- data/lib/exception_notifier/google_chat_notifier.rb +9 -9
- data/lib/exception_notifier/hipchat_notifier.rb +12 -12
- data/lib/exception_notifier/irc_notifier.rb +6 -6
- data/lib/exception_notifier/mattermost_notifier.rb +13 -13
- data/lib/exception_notifier/modules/error_grouping.rb +5 -5
- data/lib/exception_notifier/modules/formatter.rb +12 -12
- data/lib/exception_notifier/notifier.rb +3 -3
- data/lib/exception_notifier/slack_notifier.rb +16 -16
- data/lib/exception_notifier/sns_notifier.rb +9 -9
- data/lib/exception_notifier/teams_notifier.rb +61 -57
- data/lib/exception_notifier/webhook_notifier.rb +3 -3
- data/lib/exception_notifier.rb +27 -26
- data/lib/generators/exception_notification/install_generator.rb +7 -7
- data/lib/generators/exception_notification/templates/exception_notification.rb.erb +26 -27
- data/test/exception_notification/rack_test.rb +14 -14
- data/test/exception_notification/rake_test.rb +13 -13
- data/test/exception_notification/resque_test.rb +14 -14
- data/test/exception_notifier/datadog_notifier_test.rb +47 -46
- data/test/exception_notifier/email_notifier_test.rb +89 -98
- data/test/exception_notifier/google_chat_notifier_test.rb +77 -77
- data/test/exception_notifier/hipchat_notifier_test.rb +76 -74
- data/test/exception_notifier/irc_notifier_test.rb +26 -26
- data/test/exception_notifier/mattermost_notifier_test.rb +77 -77
- data/test/exception_notifier/modules/error_grouping_test.rb +39 -39
- data/test/exception_notifier/modules/formatter_test.rb +51 -49
- data/test/exception_notifier/sidekiq_test.rb +17 -10
- data/test/exception_notifier/slack_notifier_test.rb +66 -67
- data/test/exception_notifier/sns_notifier_test.rb +73 -70
- data/test/exception_notifier/teams_notifier_test.rb +33 -33
- data/test/exception_notifier/webhook_notifier_test.rb +34 -34
- data/test/exception_notifier_test.rb +51 -41
- data/test/test_helper.rb +8 -11
- metadata +45 -85
- data/Appraisals +0 -9
- data/gemfiles/rails5_2.gemfile +0 -7
- data/gemfiles/rails6_0.gemfile +0 -7
- data/gemfiles/rails6_1.gemfile +0 -7
- data/gemfiles/rails7_0.gemfile +0 -7
@@ -1,37 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "test_helper"
|
4
|
+
require "aws-sdk-sns"
|
5
5
|
|
6
6
|
class SnsNotifierTest < ActiveSupport::TestCase
|
7
7
|
def setup
|
8
8
|
@exception = fake_exception
|
9
|
-
@exception.stubs(:class).returns(
|
9
|
+
@exception.stubs(:class).returns("MyException")
|
10
10
|
@exception.stubs(:backtrace).returns(fake_backtrace)
|
11
11
|
@exception.stubs(:message).returns("undefined method 'method=' for Empty")
|
12
12
|
@options = {
|
13
|
-
access_key_id:
|
14
|
-
secret_access_key:
|
15
|
-
region:
|
16
|
-
topic_arn:
|
17
|
-
sns_prefix:
|
13
|
+
access_key_id: "my-access_key_id",
|
14
|
+
secret_access_key: "my-secret_access_key",
|
15
|
+
region: "us-east",
|
16
|
+
topic_arn: "topicARN",
|
17
|
+
sns_prefix: "[App Exception]"
|
18
18
|
}
|
19
|
-
Socket.stubs(:gethostname).returns(
|
19
|
+
Socket.stubs(:gethostname).returns("example.com")
|
20
20
|
end
|
21
21
|
|
22
22
|
# initialize
|
23
23
|
|
24
|
-
test
|
24
|
+
test "should initialize aws notifier with received params" do
|
25
25
|
Aws::SNS::Client.expects(:new).with(
|
26
|
-
region:
|
27
|
-
access_key_id:
|
28
|
-
secret_access_key:
|
26
|
+
region: "us-east",
|
27
|
+
access_key_id: "my-access_key_id",
|
28
|
+
secret_access_key: "my-secret_access_key"
|
29
29
|
)
|
30
30
|
|
31
31
|
ExceptionNotifier::SnsNotifier.new(@options)
|
32
32
|
end
|
33
33
|
|
34
|
-
test
|
34
|
+
test "should raise an exception if region is not received" do
|
35
35
|
@options[:region] = nil
|
36
36
|
|
37
37
|
error = assert_raises ArgumentError do
|
@@ -40,7 +40,7 @@ class SnsNotifierTest < ActiveSupport::TestCase
|
|
40
40
|
assert_equal "You must provide 'region' option", error.message
|
41
41
|
end
|
42
42
|
|
43
|
-
test
|
43
|
+
test "should raise an exception on publish if access_key_id is not received" do
|
44
44
|
@options[:access_key_id] = nil
|
45
45
|
error = assert_raises ArgumentError do
|
46
46
|
ExceptionNotifier::SnsNotifier.new(@options)
|
@@ -49,7 +49,7 @@ class SnsNotifierTest < ActiveSupport::TestCase
|
|
49
49
|
assert_equal "You must provide 'access_key_id' option", error.message
|
50
50
|
end
|
51
51
|
|
52
|
-
test
|
52
|
+
test "should raise an exception on publish if secret_access_key is not received" do
|
53
53
|
@options[:secret_access_key] = nil
|
54
54
|
error = assert_raises ArgumentError do
|
55
55
|
ExceptionNotifier::SnsNotifier.new(@options)
|
@@ -60,119 +60,122 @@ class SnsNotifierTest < ActiveSupport::TestCase
|
|
60
60
|
|
61
61
|
# call
|
62
62
|
|
63
|
-
test
|
63
|
+
test "should send a sns notification in background" do
|
64
64
|
Aws::SNS::Client.any_instance.expects(:publish).with(
|
65
|
-
topic_arn:
|
65
|
+
topic_arn: "topicARN",
|
66
66
|
message: "3 MyException occured in background\n" \
|
67
67
|
"Exception: undefined method 'method=' for Empty\n" \
|
68
68
|
"Hostname: example.com\n" \
|
69
69
|
"Data: {}\n" \
|
70
70
|
"Backtrace:\n#{fake_backtrace.join("\n")}\n",
|
71
|
-
subject:
|
71
|
+
subject: "[App Exception] - 3 MyException occurred"
|
72
72
|
)
|
73
73
|
|
74
74
|
sns_notifier = ExceptionNotifier::SnsNotifier.new(@options)
|
75
75
|
sns_notifier.call(@exception, accumulated_errors_count: 3)
|
76
76
|
end
|
77
77
|
|
78
|
-
test
|
79
|
-
controller = mock(
|
80
|
-
controller.stubs(:action_name).returns(
|
81
|
-
controller.stubs(:controller_name).returns(
|
78
|
+
test "should send a sns notification with controller#action information" do
|
79
|
+
controller = mock("controller")
|
80
|
+
controller.stubs(:action_name).returns("index")
|
81
|
+
controller.stubs(:controller_name).returns("examples")
|
82
82
|
|
83
83
|
Aws::SNS::Client.any_instance.expects(:publish).with(
|
84
|
-
topic_arn:
|
85
|
-
message:
|
84
|
+
topic_arn: "topicARN",
|
85
|
+
message: "A MyException occurred while GET </examples> " \
|
86
86
|
"was processed by examples#index\n" \
|
87
87
|
"Exception: undefined method 'method=' for Empty\n" \
|
88
88
|
"Hostname: example.com\n" \
|
89
89
|
"Data: {}\n" \
|
90
90
|
"Backtrace:\n#{fake_backtrace.join("\n")}\n",
|
91
|
-
subject:
|
91
|
+
subject: "[App Exception] - A MyException occurred"
|
92
92
|
)
|
93
93
|
|
94
94
|
sns_notifier = ExceptionNotifier::SnsNotifier.new(@options)
|
95
95
|
sns_notifier.call(@exception,
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
env: {
|
97
|
+
"REQUEST_METHOD" => "GET",
|
98
|
+
"REQUEST_URI" => "/examples",
|
99
|
+
"action_controller.instance" => controller
|
100
|
+
})
|
101
101
|
end
|
102
102
|
|
103
103
|
test 'should put data from env["exception_notifier.exception_data"] into text' do
|
104
|
-
controller = mock(
|
105
|
-
controller.stubs(:action_name).returns(
|
106
|
-
controller.stubs(:controller_name).returns(
|
104
|
+
controller = mock("controller")
|
105
|
+
controller.stubs(:action_name).returns("index")
|
106
|
+
controller.stubs(:controller_name).returns("examples")
|
107
107
|
|
108
|
+
# standard:disable Lint/LiteralInInterpolation
|
108
109
|
Aws::SNS::Client.any_instance.expects(:publish).with(
|
109
|
-
topic_arn:
|
110
|
-
message:
|
110
|
+
topic_arn: "topicARN",
|
111
|
+
message: "A MyException occurred while GET </examples> " \
|
111
112
|
"was processed by examples#index\n" \
|
112
113
|
"Exception: undefined method 'method=' for Empty\n" \
|
113
114
|
"Hostname: example.com\n" \
|
114
|
-
"Data: {:
|
115
|
+
"Data: #{{current_user: 12}}\n" \
|
115
116
|
"Backtrace:\n#{fake_backtrace.join("\n")}\n",
|
116
|
-
subject:
|
117
|
+
subject: "[App Exception] - A MyException occurred"
|
117
118
|
)
|
118
|
-
|
119
|
+
# standard:enable Lint/LiteralInInterpolation
|
119
120
|
sns_notifier = ExceptionNotifier::SnsNotifier.new(@options)
|
120
121
|
sns_notifier.call(@exception,
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
122
|
+
env: {
|
123
|
+
"REQUEST_METHOD" => "GET",
|
124
|
+
"REQUEST_URI" => "/examples",
|
125
|
+
"action_controller.instance" => controller,
|
126
|
+
"exception_notifier.exception_data" => {current_user: 12}
|
127
|
+
})
|
127
128
|
end
|
128
|
-
test 'should put optional data into text' do
|
129
|
-
controller = mock('controller')
|
130
|
-
controller.stubs(:action_name).returns('index')
|
131
|
-
controller.stubs(:controller_name).returns('examples')
|
132
129
|
|
130
|
+
test "should put optional data into text" do
|
131
|
+
controller = mock("controller")
|
132
|
+
controller.stubs(:action_name).returns("index")
|
133
|
+
controller.stubs(:controller_name).returns("examples")
|
134
|
+
|
135
|
+
# standard:disable Lint/LiteralInInterpolation
|
133
136
|
Aws::SNS::Client.any_instance.expects(:publish).with(
|
134
|
-
topic_arn:
|
135
|
-
message:
|
137
|
+
topic_arn: "topicARN",
|
138
|
+
message: "A MyException occurred while GET </examples> " \
|
136
139
|
"was processed by examples#index\n" \
|
137
140
|
"Exception: undefined method 'method=' for Empty\n" \
|
138
141
|
"Hostname: example.com\n" \
|
139
|
-
"Data: {:
|
142
|
+
"Data: #{{current_user: 12}}\n" \
|
140
143
|
"Backtrace:\n#{fake_backtrace.join("\n")}\n",
|
141
|
-
subject:
|
144
|
+
subject: "[App Exception] - A MyException occurred"
|
142
145
|
)
|
143
|
-
|
146
|
+
# standard:enable Lint/LiteralInInterpolation
|
144
147
|
sns_notifier = ExceptionNotifier::SnsNotifier.new(@options)
|
145
148
|
sns_notifier.call(@exception,
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
149
|
+
env: {
|
150
|
+
"REQUEST_METHOD" => "GET",
|
151
|
+
"REQUEST_URI" => "/examples",
|
152
|
+
"action_controller.instance" => controller
|
153
|
+
},
|
154
|
+
data: {
|
155
|
+
current_user: 12
|
156
|
+
})
|
154
157
|
end
|
155
158
|
|
156
159
|
private
|
157
160
|
|
158
161
|
def fake_exception
|
159
162
|
1 / 0
|
160
|
-
rescue
|
163
|
+
rescue => e
|
161
164
|
e
|
162
165
|
end
|
163
166
|
|
164
167
|
def fake_exception_without_backtrace
|
165
|
-
StandardError.new(
|
168
|
+
StandardError.new("my custom error")
|
166
169
|
end
|
167
170
|
|
168
171
|
def fake_backtrace
|
169
172
|
[
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
173
|
+
"backtrace line 1",
|
174
|
+
"backtrace line 2",
|
175
|
+
"backtrace line 3",
|
176
|
+
"backtrace line 4",
|
177
|
+
"backtrace line 5",
|
178
|
+
"backtrace line 6"
|
176
179
|
]
|
177
180
|
end
|
178
181
|
end
|
@@ -1,87 +1,87 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "test_helper"
|
4
|
+
require "httparty"
|
5
5
|
|
6
6
|
class TeamsNotifierTest < ActiveSupport::TestCase
|
7
|
-
test
|
7
|
+
test "should send notification if properly configured" do
|
8
8
|
options = {
|
9
|
-
webhook_url:
|
9
|
+
webhook_url: "http://localhost:8000"
|
10
10
|
}
|
11
11
|
teams_notifier = ExceptionNotifier::TeamsNotifier.new
|
12
12
|
teams_notifier.httparty = FakeHTTParty.new
|
13
13
|
|
14
|
-
options = teams_notifier.call ArgumentError.new(
|
14
|
+
options = teams_notifier.call ArgumentError.new("foo"), options
|
15
15
|
|
16
16
|
body = ActiveSupport::JSON.decode options[:body]
|
17
|
-
assert body.key?
|
18
|
-
assert body.key?
|
17
|
+
assert body.key? "title"
|
18
|
+
assert body.key? "sections"
|
19
19
|
|
20
|
-
sections = body[
|
20
|
+
sections = body["sections"]
|
21
21
|
header = sections[0]
|
22
22
|
|
23
23
|
assert_equal 2, sections.size
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
24
|
+
assert_equal "A *ArgumentError* occurred.", header["activityTitle"]
|
25
|
+
assert_equal "foo", header["activitySubtitle"]
|
26
26
|
end
|
27
27
|
|
28
|
-
test
|
28
|
+
test "should send notification with create gitlab issue link if specified" do
|
29
29
|
options = {
|
30
|
-
webhook_url:
|
31
|
-
git_url:
|
30
|
+
webhook_url: "http://localhost:8000",
|
31
|
+
git_url: "github.com/aschen"
|
32
32
|
}
|
33
33
|
teams_notifier = ExceptionNotifier::TeamsNotifier.new
|
34
34
|
teams_notifier.httparty = FakeHTTParty.new
|
35
35
|
|
36
|
-
options = teams_notifier.call ArgumentError.new(
|
36
|
+
options = teams_notifier.call ArgumentError.new("foo"), options
|
37
37
|
|
38
38
|
body = ActiveSupport::JSON.decode options[:body]
|
39
39
|
|
40
|
-
potential_action = body[
|
40
|
+
potential_action = body["potentialAction"]
|
41
41
|
assert_equal 2, potential_action.size
|
42
|
-
assert_equal
|
43
|
-
assert_equal
|
42
|
+
assert_equal "🦊 View in GitLab", potential_action[0]["name"]
|
43
|
+
assert_equal "🦊 Create Issue in GitLab", potential_action[1]["name"]
|
44
44
|
end
|
45
45
|
|
46
|
-
test
|
46
|
+
test "should add other HTTParty options to params" do
|
47
47
|
options = {
|
48
|
-
webhook_url:
|
49
|
-
username:
|
50
|
-
avatar:
|
48
|
+
webhook_url: "http://localhost:8000",
|
49
|
+
username: "Test Bot",
|
50
|
+
avatar: "http://site.com/icon.png",
|
51
51
|
basic_auth: {
|
52
|
-
username:
|
53
|
-
password:
|
52
|
+
username: "clara",
|
53
|
+
password: "password"
|
54
54
|
}
|
55
55
|
}
|
56
56
|
teams_notifier = ExceptionNotifier::TeamsNotifier.new
|
57
57
|
teams_notifier.httparty = FakeHTTParty.new
|
58
58
|
|
59
|
-
options = teams_notifier.call ArgumentError.new(
|
59
|
+
options = teams_notifier.call ArgumentError.new("foo"), options
|
60
60
|
|
61
61
|
assert options.key? :basic_auth
|
62
|
-
assert
|
63
|
-
assert
|
62
|
+
assert "clara", options[:basic_auth][:username]
|
63
|
+
assert "password", options[:basic_auth][:password]
|
64
64
|
end
|
65
65
|
|
66
66
|
test "should use 'A' for exceptions count if :accumulated_errors_count option is nil" do
|
67
67
|
teams_notifier = ExceptionNotifier::TeamsNotifier.new
|
68
|
-
exception = ArgumentError.new(
|
68
|
+
exception = ArgumentError.new("foo")
|
69
69
|
teams_notifier.instance_variable_set(:@exception, exception)
|
70
70
|
teams_notifier.instance_variable_set(:@options, {})
|
71
71
|
|
72
72
|
message_text = teams_notifier.send(:message_text)
|
73
|
-
header = message_text[
|
74
|
-
assert_equal
|
73
|
+
header = message_text["sections"][0]
|
74
|
+
assert_equal "A *ArgumentError* occurred.", header["activityTitle"]
|
75
75
|
end
|
76
76
|
|
77
|
-
test
|
77
|
+
test "should use direct errors count if :accumulated_errors_count option is 5" do
|
78
78
|
teams_notifier = ExceptionNotifier::TeamsNotifier.new
|
79
|
-
exception = ArgumentError.new(
|
79
|
+
exception = ArgumentError.new("foo")
|
80
80
|
teams_notifier.instance_variable_set(:@exception, exception)
|
81
81
|
teams_notifier.instance_variable_set(:@options, accumulated_errors_count: 5)
|
82
82
|
message_text = teams_notifier.send(:message_text)
|
83
|
-
header = message_text[
|
84
|
-
assert_equal
|
83
|
+
header = message_text["sections"][0]
|
84
|
+
assert_equal "5 *ArgumentError* occurred.", header["activityTitle"]
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
@@ -1,34 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "test_helper"
|
4
|
+
require "httparty"
|
5
5
|
|
6
6
|
class WebhookNotifierTest < ActiveSupport::TestCase
|
7
|
-
test
|
7
|
+
test "should send webhook notification if properly configured" do
|
8
8
|
ExceptionNotifier::WebhookNotifier.stubs(:new).returns(Object.new)
|
9
|
-
webhook = ExceptionNotifier::WebhookNotifier.new(url:
|
9
|
+
webhook = ExceptionNotifier::WebhookNotifier.new(url: "http://localhost:8000")
|
10
10
|
webhook.stubs(:call).returns(fake_response)
|
11
11
|
response = webhook.call(fake_exception)
|
12
12
|
|
13
13
|
refute_nil response
|
14
14
|
assert_equal response[:status], 200
|
15
|
-
assert_equal response[:body][:exception][:error_class],
|
16
|
-
assert_includes response[:body][:exception][:message],
|
17
|
-
assert_includes response[:body][:exception][:backtrace],
|
15
|
+
assert_equal response[:body][:exception][:error_class], "ZeroDivisionError"
|
16
|
+
assert_includes response[:body][:exception][:message], "divided by 0"
|
17
|
+
assert_includes response[:body][:exception][:backtrace], "/exception_notification/test/webhook_notifier_test.rb:48"
|
18
18
|
|
19
19
|
assert response[:body][:request][:cookies].key?(:cookie_item1)
|
20
|
-
assert_equal response[:body][:request][:url],
|
21
|
-
assert_equal response[:body][:request][:ip_address],
|
20
|
+
assert_equal response[:body][:request][:url], "http://example.com/example"
|
21
|
+
assert_equal response[:body][:request][:ip_address], "192.168.1.1"
|
22
22
|
assert response[:body][:request][:environment].key?(:env_item1)
|
23
|
-
assert_equal response[:body][:request][:controller],
|
23
|
+
assert_equal response[:body][:request][:controller], "#<ControllerName:0x007f9642a04d00>"
|
24
24
|
assert response[:body][:request][:session].key?(:session_item1)
|
25
25
|
assert response[:body][:request][:parameters].key?(:controller)
|
26
26
|
assert response[:body][:data][:extra_data].key?(:data_item1)
|
27
27
|
end
|
28
28
|
|
29
|
-
test
|
30
|
-
url =
|
31
|
-
fake_exception.stubs(:backtrace).returns(
|
29
|
+
test "should send webhook notification with correct params data" do
|
30
|
+
url = "http://localhost:8000"
|
31
|
+
fake_exception.stubs(:backtrace).returns("the backtrace")
|
32
32
|
webhook = ExceptionNotifier::WebhookNotifier.new(url: url)
|
33
33
|
|
34
34
|
HTTParty.expects(:send).with(:post, url, fake_params)
|
@@ -36,9 +36,9 @@ class WebhookNotifierTest < ActiveSupport::TestCase
|
|
36
36
|
webhook.call(fake_exception)
|
37
37
|
end
|
38
38
|
|
39
|
-
test
|
40
|
-
HTTParty.
|
41
|
-
webhook = ExceptionNotifier::WebhookNotifier.new(url:
|
39
|
+
test "should call pre/post_callback if specified" do
|
40
|
+
HTTParty.expects(:send).returns(fake_response)
|
41
|
+
webhook = ExceptionNotifier::WebhookNotifier.new(url: "http://localhost:8000")
|
42
42
|
webhook.call(fake_exception)
|
43
43
|
end
|
44
44
|
|
@@ -49,21 +49,21 @@ class WebhookNotifierTest < ActiveSupport::TestCase
|
|
49
49
|
status: 200,
|
50
50
|
body: {
|
51
51
|
exception: {
|
52
|
-
error_class:
|
53
|
-
message:
|
54
|
-
backtrace:
|
52
|
+
error_class: "ZeroDivisionError",
|
53
|
+
message: "divided by 0",
|
54
|
+
backtrace: "/exception_notification/test/webhook_notifier_test.rb:48:in `/"
|
55
55
|
},
|
56
56
|
data: {
|
57
|
-
extra_data: {
|
57
|
+
extra_data: {data_item1: "datavalue1", data_item2: "datavalue2"}
|
58
58
|
},
|
59
59
|
request: {
|
60
|
-
cookies: {
|
61
|
-
url:
|
62
|
-
ip_address:
|
63
|
-
environment: {
|
64
|
-
controller:
|
65
|
-
session: {
|
66
|
-
parameters: {
|
60
|
+
cookies: {cookie_item1: "cookieitemvalue1", cookie_item2: "cookieitemvalue2"},
|
61
|
+
url: "http://example.com/example",
|
62
|
+
ip_address: "192.168.1.1",
|
63
|
+
environment: {env_item1: "envitem1", env_item2: "envitem2"},
|
64
|
+
controller: "#<ControllerName:0x007f9642a04d00>",
|
65
|
+
session: {session_item1: "sessionitem1", session_item2: "sessionitem2"},
|
66
|
+
parameters: {action: "index", controller: "projects"}
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|
@@ -75,9 +75,9 @@ class WebhookNotifierTest < ActiveSupport::TestCase
|
|
75
75
|
server: Socket.gethostname,
|
76
76
|
process: $PROCESS_ID,
|
77
77
|
exception: {
|
78
|
-
error_class:
|
79
|
-
message:
|
80
|
-
backtrace:
|
78
|
+
error_class: "ZeroDivisionError",
|
79
|
+
message: "divided by 0".inspect,
|
80
|
+
backtrace: "the backtrace"
|
81
81
|
},
|
82
82
|
data: {}
|
83
83
|
}
|
@@ -90,9 +90,9 @@ class WebhookNotifierTest < ActiveSupport::TestCase
|
|
90
90
|
|
91
91
|
def fake_exception
|
92
92
|
@fake_exception ||= begin
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
5 / 0
|
94
|
+
rescue => e
|
95
|
+
e
|
96
|
+
end
|
97
97
|
end
|
98
98
|
end
|