phildarnowsky-merb_hoptoad_notifier 1.0.2.5 → 1.0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/spec/merb_hoptoad_notifier_spec.rb +50 -0
- metadata +4 -5
@@ -73,6 +73,56 @@ describe "HoptoadNotifier" do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
describe ".warn_hoptoad" do
|
77
|
+
describe "when request is nil" do
|
78
|
+
it "should return nil" do
|
79
|
+
HoptoadNotifier.warn_hoptoad(nil, nil, nil).should be_nil
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should not send anything to hoptoad" do
|
83
|
+
dont_allow(HoptoadNotifier).send_to_hoptoad
|
84
|
+
HoptoadNotifier.warn_hoptoad(nil, nil, nil)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "when request is not nil" do
|
89
|
+
before(:each) do
|
90
|
+
mock(HoptoadNotifier).send_to_hoptoad(anything)
|
91
|
+
@request = setup_merb_request
|
92
|
+
mock(@request).params { {"banana_count" => "666"} }
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should return true" do
|
96
|
+
HoptoadNotifier.warn_hoptoad(nil, @request, {}).should be_true
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "and options[:error_class] is set" do
|
100
|
+
it "should use that for the error class instead of message" do
|
101
|
+
RR::Space.reset_double(HoptoadNotifier, :send_to_hoptoad)
|
102
|
+
|
103
|
+
# Must use satisfy here because hash_including doesn't seem to work for nested hashes
|
104
|
+
mock(HoptoadNotifier).send_to_hoptoad(
|
105
|
+
satisfy {|arg| arg[:notice][:error_class] == "ToasterFireException"}
|
106
|
+
)
|
107
|
+
|
108
|
+
HoptoadNotifier.warn_hoptoad(nil, @request, {}, :error_class => "ToasterFireException")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "and options[:error_class] is not set" do
|
113
|
+
it "should use message for the error class" do
|
114
|
+
RR::Space.reset_double(HoptoadNotifier, :send_to_hoptoad)
|
115
|
+
|
116
|
+
mock(HoptoadNotifier).send_to_hoptoad(
|
117
|
+
satisfy {|arg| arg[:notice][:error_class] == "Out of cheese"}
|
118
|
+
)
|
119
|
+
|
120
|
+
HoptoadNotifier.warn_hoptoad("Out of cheese", @request, {}, {})
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
76
126
|
describe ".send_to_hoptoad" do
|
77
127
|
describe "any 2XX response" do
|
78
128
|
before(:each) do
|
metadata
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phildarnowsky-merb_hoptoad_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.2.
|
4
|
+
version: 1.0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Donohoe
|
8
|
-
- Phil Darnowsky
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
11
|
|
13
|
-
date: 2009-
|
12
|
+
date: 2009-03-11 00:00:00 -07:00
|
14
13
|
default_executable:
|
15
14
|
dependencies: []
|
16
15
|
|
17
16
|
description: Merb plugin that provides hoptoad exception notification
|
18
|
-
email:
|
17
|
+
email:
|
19
18
|
executables: []
|
20
19
|
|
21
20
|
extensions: []
|
@@ -40,7 +39,7 @@ files:
|
|
40
39
|
- spec/spec.opts
|
41
40
|
- spec/spec_helper.rb
|
42
41
|
has_rdoc: true
|
43
|
-
homepage: http://github.com/
|
42
|
+
homepage: http://github.com/atmos
|
44
43
|
post_install_message:
|
45
44
|
rdoc_options: []
|
46
45
|
|