relevance-chatterbox 0.2.2 → 0.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.
- data/chatterbox.gemspec +3 -4
- data/examples/lib/chatterbox/notification_example.rb +16 -7
- data/lib/chatterbox/notification.rb +6 -3
- data/version.yml +2 -2
- metadata +4 -5
data/chatterbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chatterbox}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rob Sanheim"]
|
12
|
-
s.date = %q{2009-08-
|
12
|
+
s.date = %q{2009-08-31}
|
13
13
|
s.email = %q{rsanheim@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -38,11 +38,10 @@ Gem::Specification.new do |s|
|
|
38
38
|
"version.yml",
|
39
39
|
"views/chatterbox/mailer/exception_notification.erb"
|
40
40
|
]
|
41
|
-
s.has_rdoc = true
|
42
41
|
s.homepage = %q{http://github.com/relevance/chatterbox}
|
43
42
|
s.rdoc_options = ["--charset=UTF-8"]
|
44
43
|
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.3.
|
44
|
+
s.rubygems_version = %q{1.3.5}
|
46
45
|
s.summary = %q{TODO}
|
47
46
|
s.test_files = [
|
48
47
|
"examples/chatterbox_example.rb",
|
@@ -14,13 +14,6 @@ describe Chatterbox::Notification do
|
|
14
14
|
}.should_not raise_error
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should convert exception to notice" do
|
18
|
-
exception = RuntimeError.new
|
19
|
-
notification = Chatterbox::Notification.new(exception)
|
20
|
-
notification.expects(:exception_to_notice).with(exception).returns({})
|
21
|
-
notification.notice
|
22
|
-
end
|
23
|
-
|
24
17
|
it "should use to_hash if message is not an exception and it responds_to possible" do
|
25
18
|
some_object = mock(:to_hash => {:foo => "bar"})
|
26
19
|
Chatterbox::Notification.new(some_object).notice.should include({:foo => "bar"})
|
@@ -74,6 +67,22 @@ describe Chatterbox::Notification do
|
|
74
67
|
data[:backtrace].should == exception.backtrace
|
75
68
|
end
|
76
69
|
|
70
|
+
it "should extract exception info from an exception in a hash" do
|
71
|
+
exception = raised_exception
|
72
|
+
data = Chatterbox::Notification.new(:exception => exception, :other_info => "yo dawg").notice
|
73
|
+
data[:summary].should == "RuntimeError: Your zing bats got mixed up with the snosh frazzles."
|
74
|
+
data[:error_class].should == "RuntimeError"
|
75
|
+
data[:error_message].should == "Your zing bats got mixed up with the snosh frazzles."
|
76
|
+
data[:backtrace].should == exception.backtrace
|
77
|
+
data[:other_info].should == "yo dawg"
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should let extra data win over auto extracted exception data" do
|
81
|
+
exception = raised_exception
|
82
|
+
data = Chatterbox::Notification.new(:exception => exception, :summary => "I know what I'm doing, and we got an error").notice
|
83
|
+
data[:summary].should == "I know what I'm doing, and we got an error"
|
84
|
+
end
|
85
|
+
|
77
86
|
it "merges rails info and ruby info into the exception info" do
|
78
87
|
notification = Chatterbox::Notification.new(raised_exception)
|
79
88
|
rails = stub_everything(:version => "2.0", :root => "/rails/root", :env => "production")
|
@@ -10,13 +10,14 @@ module Chatterbox
|
|
10
10
|
|
11
11
|
def notice
|
12
12
|
hash = normalize_message_to_hash(message)
|
13
|
+
hash = exception_to_notice(hash)
|
13
14
|
default_info.merge(hash)
|
14
15
|
end
|
15
16
|
|
16
17
|
def normalize_message_to_hash(message)
|
17
18
|
case
|
18
19
|
when Exception === message
|
19
|
-
|
20
|
+
{ :exception => message }
|
20
21
|
when message.respond_to?(:to_hash)
|
21
22
|
message.to_hash
|
22
23
|
when message.respond_to?(:to_s)
|
@@ -40,13 +41,15 @@ module Chatterbox
|
|
40
41
|
{ :summary => message }
|
41
42
|
end
|
42
43
|
|
43
|
-
def exception_to_notice(
|
44
|
+
def exception_to_notice(hash)
|
45
|
+
return hash unless hash.key?(:exception)
|
46
|
+
exception = hash[:exception]
|
44
47
|
{
|
45
48
|
:summary => "#{exception.class.name}: #{exception.message}",
|
46
49
|
:error_class => exception.class.name,
|
47
50
|
:error_message => exception.message,
|
48
51
|
:backtrace => exception.backtrace,
|
49
|
-
}
|
52
|
+
}.merge(hash)
|
50
53
|
end
|
51
54
|
|
52
55
|
def add_rails_info(data)
|
data/version.yml
CHANGED
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -44,9 +44,8 @@ files:
|
|
44
44
|
- todo.markdown
|
45
45
|
- version.yml
|
46
46
|
- views/chatterbox/mailer/exception_notification.erb
|
47
|
-
has_rdoc:
|
47
|
+
has_rdoc: false
|
48
48
|
homepage: http://github.com/relevance/chatterbox
|
49
|
-
licenses:
|
50
49
|
post_install_message:
|
51
50
|
rdoc_options:
|
52
51
|
- --charset=UTF-8
|
@@ -67,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
66
|
requirements: []
|
68
67
|
|
69
68
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.2.0
|
71
70
|
signing_key:
|
72
71
|
specification_version: 3
|
73
72
|
summary: TODO
|