relevance-chatterbox 0.3.0 → 0.3.1
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.
data/chatterbox.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ require 'chatterbox'
|
|
|
4
4
|
describe Chatterbox::Mailer do
|
|
5
5
|
|
|
6
6
|
it "displays environment vars sorted" do
|
|
7
|
-
|
|
7
|
+
notice = {
|
|
8
8
|
:environment => {
|
|
9
9
|
"PATH" => "/usr/bin",
|
|
10
10
|
"PS1" => "$",
|
|
@@ -16,16 +16,33 @@ PATH => /usr/bin
|
|
|
16
16
|
PS1 => $
|
|
17
17
|
TMPDIR => /tmp
|
|
18
18
|
EOL
|
|
19
|
-
mail = Chatterbox::Mailer.create_exception_notification(
|
|
19
|
+
mail = Chatterbox::Mailer.create_exception_notification(notice)
|
|
20
20
|
mail.body.should include(expected.strip)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
it "displays any other details in the hash in the email body" do
|
|
24
|
+
notice = {
|
|
25
|
+
:details => {
|
|
26
|
+
:message_id => 'user01-create', :current_user => "Chris Liebing"},
|
|
27
|
+
:environment => { :path => "foo" }
|
|
28
|
+
}
|
|
29
|
+
Chatterbox::Mailer.create_exception_notification(notice)
|
|
30
|
+
expected = <<EOL
|
|
31
|
+
Details
|
|
32
|
+
-------
|
|
33
|
+
current_user => Chris Liebing
|
|
34
|
+
message_id => user01-create
|
|
35
|
+
EOL
|
|
36
|
+
mail = Chatterbox::Mailer.create_exception_notification(notice)
|
|
37
|
+
mail.body.should include(expected.strip)
|
|
38
|
+
end
|
|
39
|
+
|
|
23
40
|
it "does not mutate the provided hash" do
|
|
24
|
-
|
|
25
|
-
Chatterbox::Mailer.create_exception_notification(
|
|
26
|
-
|
|
41
|
+
notice = {'foo' => 'bar', :environment => {}}
|
|
42
|
+
Chatterbox::Mailer.create_exception_notification(notice)
|
|
43
|
+
notice.should == {'foo' => 'bar', :environment => {}}
|
|
27
44
|
end
|
|
28
|
-
|
|
45
|
+
|
|
29
46
|
describe "subject" do
|
|
30
47
|
|
|
31
48
|
it "extracts the subject from the given data hash when the key is a symbol" do
|
|
@@ -14,6 +14,13 @@ module Chatterbox
|
|
|
14
14
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Things taken out of the hash for exception emails:
|
|
18
|
+
#
|
|
19
|
+
# :details => a hash of details about the context of the error -- ie current state, request info, etc...any info
|
|
20
|
+
# related to the exception that is domain specific
|
|
21
|
+
# :error_class => taken from the Exception
|
|
22
|
+
# :error_message => taken from the Exception
|
|
23
|
+
# :backtrace => taken from the Exception
|
|
17
24
|
class Mailer < ActionMailer::Base
|
|
18
25
|
@@sender_address = %("Exception Notifier" <exception.notifier@default.com>)
|
|
19
26
|
cattr_accessor :sender_address
|
|
@@ -29,11 +36,11 @@ module Chatterbox
|
|
|
29
36
|
def self.reloadable?() false end
|
|
30
37
|
|
|
31
38
|
def exception_notification(data={})
|
|
32
|
-
data = data.symbolize_keys
|
|
39
|
+
data = data.dup.symbolize_keys
|
|
33
40
|
|
|
34
41
|
content_type "text/plain"
|
|
35
42
|
|
|
36
|
-
subject "#{email_prefix} Error - #{data
|
|
43
|
+
subject "#{email_prefix} Error - #{data.delete(:summary)}"
|
|
37
44
|
|
|
38
45
|
recipients exception_recipients
|
|
39
46
|
from sender_address
|
data/version.yml
CHANGED
|
@@ -2,12 +2,18 @@ Error Message
|
|
|
2
2
|
--------------
|
|
3
3
|
<%= @error_class %>: <%= @error_message %>
|
|
4
4
|
|
|
5
|
+
Details
|
|
6
|
+
-------
|
|
7
|
+
<% @details.keys.map(&:to_s).sort.each do |key| -%>
|
|
8
|
+
<%= %[#{key} => #{@details[key.to_sym]}] %>
|
|
9
|
+
<% end if @details -%>
|
|
10
|
+
|
|
5
11
|
Backtrace
|
|
6
12
|
----------
|
|
7
13
|
<%= @backtrace.join "\n" if @backtrace %>
|
|
8
14
|
|
|
9
15
|
Environment
|
|
10
16
|
------------
|
|
11
|
-
<% @environment.keys.sort.each do |key|
|
|
12
|
-
<%= %[#{key} => #{@environment[key]}]
|
|
17
|
+
<% @environment.keys.sort.each do |key| -%>
|
|
18
|
+
<%= %[#{key} => #{@environment[key]}] %>
|
|
13
19
|
<% end -%>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relevance-chatterbox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Sanheim
|
|
@@ -46,6 +46,7 @@ files:
|
|
|
46
46
|
- views/chatterbox/mailer/exception_notification.erb
|
|
47
47
|
has_rdoc: false
|
|
48
48
|
homepage: http://github.com/relevance/chatterbox
|
|
49
|
+
licenses:
|
|
49
50
|
post_install_message:
|
|
50
51
|
rdoc_options:
|
|
51
52
|
- --charset=UTF-8
|
|
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
67
|
requirements: []
|
|
67
68
|
|
|
68
69
|
rubyforge_project:
|
|
69
|
-
rubygems_version: 1.
|
|
70
|
+
rubygems_version: 1.3.5
|
|
70
71
|
signing_key:
|
|
71
72
|
specification_version: 3
|
|
72
73
|
summary: TODO
|