exception_notification 4.1.3 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3696eecc7d4afcf68b5458d570f811a595b2e912
4
- data.tar.gz: 1a5d379db9e9e9dff3d4e15c1b9e3f435daa41f3
3
+ metadata.gz: 7d847c323ad183933f5a1d63e29f06e9e8d6aaa9
4
+ data.tar.gz: 06b5d75b2ca566178384e2d8c60982b73aa1b567
5
5
  SHA512:
6
- metadata.gz: bde0dd2960675f710e0073d38f2f4e75bc7b783de92ea337337b83e67ce39a7650911a182743c2cd2200082b74fb113c0619e453e3817e2fa52b0796b841f3dd
7
- data.tar.gz: 6caf354673c7e63c800fa9417d5bf9df72220257a891895326bbae110aaa4879770d87fb30113e555014b691094f9f4e47a7968bc619f3d6e18a60a3b09a3eae
6
+ metadata.gz: 2d0744472e25aab1f35eaf6c66ab6ddd771885560fec22d3b60d6799ddff773689e1faf75af486b48280f59528fc119a54661474e0c56a86ed855799b213ba33
7
+ data.tar.gz: 2e51a10be77772151a0f866f81f105bf8b76d2d92bbd98537b36377db752592abd7704387380118bf3b40cb36c825b232f8bb26a41d7f27e5de9bb43928fbf60
@@ -1,4 +1,10 @@
1
- == undefined
1
+ == 4.1.4
2
+
3
+ * bug fixes
4
+ * HTML-escape exception messages sent to hipchat
5
+ * Send the correct options in send_notice
6
+
7
+ == 4.1.3
2
8
 
3
9
  * enhancements
4
10
  * Add a way to have a backtrace callback on notifiers (by @pcboy)
@@ -1,8 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'exception_notification'
3
- s.version = '4.1.3'
3
+ s.version = '4.1.4'
4
4
  s.authors = ["Jamis Buck", "Josh Peek"]
5
- s.date = %q{2015-12-22}
6
5
  s.summary = "Exception notification for Rails apps"
7
6
  s.homepage = "http://smartinez87.github.com/exception_notification"
8
7
  s.email = "smartinez87@gmail.com"
@@ -14,11 +14,11 @@ module ExceptionNotifier
14
14
  end
15
15
 
16
16
  def _pre_callback(exception, options, message, message_opts)
17
- @base_options[:pre_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call)
17
+ @base_options[:pre_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:pre_callback].respond_to?(:call)
18
18
  end
19
19
 
20
20
  def _post_callback(exception, options, message, message_opts)
21
- @base_options[:post_callback].call(base_options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call)
21
+ @base_options[:post_callback].call(options, self, exception.backtrace, message, message_opts) if @base_options[:post_callback].respond_to?(:call)
22
22
  end
23
23
 
24
24
  end
@@ -16,7 +16,7 @@ module ExceptionNotifier
16
16
  @from = options.delete(:from) || 'Exception'
17
17
  @room = HipChat::Client.new(api_token, opts)[room_name]
18
18
  @message_template = options.delete(:message_template) || ->(exception) {
19
- msg = "A new exception occurred: '#{exception.message}'"
19
+ msg = "A new exception occurred: '#{Rack::Utils.escape_html(exception.message)}'"
20
20
  msg += " on '#{exception.backtrace.first}'" if exception.backtrace
21
21
  msg
22
22
  }
@@ -104,6 +104,22 @@ class HipchatNotifierTest < ActiveSupport::TestCase
104
104
  hipchat.call(fake_exception)
105
105
  end
106
106
 
107
+ test "should send hipchat notification with HTML-escaped meessage if using default message_template" do
108
+ options = {
109
+ :api_token => 'good_token',
110
+ :room_name => 'room_name',
111
+ :color => 'yellow',
112
+ }
113
+
114
+ exception = fake_exception_with_html_characters
115
+ body = "A new exception occurred: '#{Rack::Utils.escape_html(exception.message)}' on '#{exception.backtrace.first}'"
116
+
117
+ HipChat::Room.any_instance.expects(:send).with('Exception', body, { :color => 'yellow' })
118
+
119
+ hipchat = ExceptionNotifier::HipchatNotifier.new(options)
120
+ hipchat.call(exception)
121
+ end
122
+
107
123
  test "should use APIv1 if api_version is not specified" do
108
124
  options = {
109
125
  :api_token => 'good_token',
@@ -143,6 +159,14 @@ class HipchatNotifierTest < ActiveSupport::TestCase
143
159
  end
144
160
  end
145
161
 
162
+ def fake_exception_with_html_characters
163
+ exception = begin
164
+ raise StandardError.new('an error with <html> characters')
165
+ rescue Exception => e
166
+ e
167
+ end
168
+ end
169
+
146
170
  def fake_body_without_backtrace
147
171
  "A new exception occurred: '#{fake_exception_without_backtrace.message}'"
148
172
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exception_notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.3
4
+ version: 4.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-22 00:00:00.000000000 Z
12
+ date: 2016-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionmailer