lilypad 0.2.4 → 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/README.markdown +70 -19
- data/gemspec.rb +1 -1
- data/lib/capistrano/lilypad.rb +21 -0
- data/lib/lilypad.rb +52 -0
- data/lib/lilypad/adapters/rails.rb +41 -0
- data/lib/lilypad/adapters/sinatra.rb +16 -0
- data/lib/lilypad/config.rb +57 -0
- data/lib/lilypad/config/request.rb +23 -0
- data/lib/lilypad/hoptoad/deploy.rb +48 -0
- data/lib/lilypad/hoptoad/notify.rb +87 -0
- data/lib/lilypad/hoptoad/xml.rb +61 -0
- data/lib/lilypad/log.rb +51 -0
- data/lib/rack/lilypad.rb +9 -143
- data/spec/fixtures/rails/config/environment.rb +2 -2
- data/spec/fixtures/rails/log/production.log +15987 -620
- data/spec/fixtures/sinatra.rb +5 -1
- data/spec/lilypad/adapters/rails_spec.rb +67 -0
- data/spec/lilypad/adapters/sinatra_spec.rb +49 -0
- data/spec/lilypad/config/request_spec.rb +27 -0
- data/spec/lilypad/config_spec.rb +59 -0
- data/spec/lilypad/hoptoad/deploy_spec.rb +85 -0
- data/spec/lilypad/hoptoad/notify_spec.rb +138 -0
- data/spec/lilypad_spec.rb +76 -0
- data/spec/spec_helper.rb +12 -2
- metadata +19 -6
- data/lib/rack/lilypad/rails.rb +0 -27
- data/spec/fixtures/rails/log/development.log +0 -4871
- data/spec/fixtures/rails/log/staging.log +0 -196
- data/spec/rack/lilypad_spec.rb +0 -128
@@ -1,196 +0,0 @@
|
|
1
|
-
# Logfile created on 2009-12-03 16:29:16 -0800
|
2
|
-
|
3
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:16) [GET]
|
4
|
-
|
5
|
-
TestError (Test):
|
6
|
-
app/controllers/application_controller.rb:16:in `test'
|
7
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
8
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
9
|
-
<internal:prelude>:8:in `synchronize'
|
10
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
11
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:79:in `block (3 levels) in <top (required)>'
|
12
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
13
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
14
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
15
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
16
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
17
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
18
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
19
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
20
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
21
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
22
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
23
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
24
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
25
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
26
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
27
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
28
|
-
|
29
|
-
Rendered rescues/_trace (58.2ms)
|
30
|
-
Rendered rescues/_request_and_response (1.4ms)
|
31
|
-
Rendering rescues/layout (internal_server_error)
|
32
|
-
|
33
|
-
|
34
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:17) [GET]
|
35
|
-
|
36
|
-
TestError (Test):
|
37
|
-
app/controllers/application_controller.rb:16:in `test'
|
38
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
39
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
40
|
-
<internal:prelude>:8:in `synchronize'
|
41
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
42
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:79:in `block (3 levels) in <top (required)>'
|
43
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
44
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
45
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
46
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
47
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
48
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
49
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
50
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
51
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
52
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
53
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
54
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
55
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
56
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
57
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
58
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
59
|
-
|
60
|
-
Rendered rescues/_trace (87.6ms)
|
61
|
-
Rendered rescues/_request_and_response (0.3ms)
|
62
|
-
Rendering rescues/layout (internal_server_error)
|
63
|
-
|
64
|
-
|
65
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:17) [GET]
|
66
|
-
|
67
|
-
TestError (Test):
|
68
|
-
app/controllers/application_controller.rb:16:in `test'
|
69
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
70
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
71
|
-
<internal:prelude>:8:in `synchronize'
|
72
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
73
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:83:in `block (4 levels) in <top (required)>'
|
74
|
-
rspec (1.2.9) lib/spec/matchers/raise_error.rb:21:in `call'
|
75
|
-
rspec (1.2.9) lib/spec/matchers/raise_error.rb:21:in `matches?'
|
76
|
-
rspec (1.2.9) lib/spec/expectations/handler.rb:11:in `handle_matcher'
|
77
|
-
rspec (1.2.9) lib/spec/expectations/extensions/kernel.rb:27:in `should'
|
78
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:83:in `block (3 levels) in <top (required)>'
|
79
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
80
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
81
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
82
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
83
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
84
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
85
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
86
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
87
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
88
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
89
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
90
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
91
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
92
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
93
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
94
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
95
|
-
|
96
|
-
Rendered rescues/_trace (91.8ms)
|
97
|
-
Rendered rescues/_request_and_response (0.3ms)
|
98
|
-
Rendering rescues/layout (internal_server_error)
|
99
|
-
|
100
|
-
|
101
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:17) [GET]
|
102
|
-
|
103
|
-
TestError (Test):
|
104
|
-
app/controllers/application_controller.rb:16:in `test'
|
105
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
106
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
107
|
-
<internal:prelude>:8:in `synchronize'
|
108
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
109
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:83:in `block (4 levels) in <top (required)>'
|
110
|
-
rspec (1.2.9) lib/spec/matchers/raise_error.rb:21:in `call'
|
111
|
-
rspec (1.2.9) lib/spec/matchers/raise_error.rb:21:in `matches?'
|
112
|
-
rspec (1.2.9) lib/spec/expectations/handler.rb:11:in `handle_matcher'
|
113
|
-
rspec (1.2.9) lib/spec/expectations/extensions/kernel.rb:27:in `should'
|
114
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:83:in `block (3 levels) in <top (required)>'
|
115
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
116
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
117
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
118
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
119
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
120
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
121
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
122
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
123
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
124
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
125
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
126
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
127
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
128
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
129
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
130
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
131
|
-
|
132
|
-
Rendered rescues/_trace (57.4ms)
|
133
|
-
Rendered rescues/_request_and_response (0.3ms)
|
134
|
-
Rendering rescues/layout (internal_server_error)
|
135
|
-
|
136
|
-
|
137
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:17) [GET]
|
138
|
-
|
139
|
-
TestError (Test):
|
140
|
-
app/controllers/application_controller.rb:16:in `test'
|
141
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
142
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
143
|
-
<internal:prelude>:8:in `synchronize'
|
144
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
145
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:94:in `block (3 levels) in <top (required)>'
|
146
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
147
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
148
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
149
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
150
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
151
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
152
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
153
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
154
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
155
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
156
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
157
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
158
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
159
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
160
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
161
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
162
|
-
|
163
|
-
Rendered rescues/_trace (52.1ms)
|
164
|
-
Rendered rescues/_request_and_response (0.3ms)
|
165
|
-
Rendering rescues/layout (internal_server_error)
|
166
|
-
|
167
|
-
|
168
|
-
Processing ApplicationController#test (for 127.0.0.1 at 2009-12-03 16:29:17) [GET]
|
169
|
-
|
170
|
-
TestError (Test):
|
171
|
-
app/controllers/application_controller.rb:16:in `test'
|
172
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
173
|
-
/Users/winton/sites/repositories/active/lilypad/spec/fixtures/test_exception_middleware.rb:12:in `call'
|
174
|
-
<internal:prelude>:8:in `synchronize'
|
175
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/forwardable.rb:182:in `get'
|
176
|
-
/Users/winton/sites/repositories/active/lilypad/spec/rack/lilypad_spec.rb:94:in `block (3 levels) in <top (required)>'
|
177
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `instance_eval'
|
178
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:40:in `block in execute'
|
179
|
-
/Users/winton/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
|
180
|
-
rspec (1.2.9) lib/spec/example/example_methods.rb:37:in `execute'
|
181
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:214:in `block in run_examples'
|
182
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `each'
|
183
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:212:in `run_examples'
|
184
|
-
rspec (1.2.9) lib/spec/example/example_group_methods.rb:103:in `run'
|
185
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:23:in `block in run'
|
186
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `each'
|
187
|
-
rspec (1.2.9) lib/spec/runner/example_group_runner.rb:22:in `run'
|
188
|
-
rspec (1.2.9) lib/spec/runner/options.rb:151:in `run_examples'
|
189
|
-
rspec (1.2.9) lib/spec/runner/command_line.rb:9:in `run'
|
190
|
-
rspec (1.2.9) bin/spec:5:in `<top (required)>'
|
191
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `load'
|
192
|
-
/Users/winton/.rvm/gems/ruby/1.9.1/bin/spec:19:in `<main>'
|
193
|
-
|
194
|
-
Rendered rescues/_trace (85.1ms)
|
195
|
-
Rendered rescues/_request_and_response (0.3ms)
|
196
|
-
Rendering rescues/layout (internal_server_error)
|
data/spec/rack/lilypad_spec.rb
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
|
2
|
-
|
3
|
-
describe Rack::Lilypad do
|
4
|
-
|
5
|
-
include Rack::Test::Methods
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@app = lambda { |env| raise TestError, 'Test' }
|
9
|
-
@env = Rack::MockRequest.env_for("/test")
|
10
|
-
@http = mock(:http)
|
11
|
-
@http.stub!(:read_timeout=)
|
12
|
-
@http.stub!(:open_timeout=)
|
13
|
-
@http.stub!(:post).and_return Net::HTTPOK.new(nil, nil, nil)
|
14
|
-
Net::HTTP.stub!(:start).and_yield(@http)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should yield a configuration object to the block when created" do
|
18
|
-
notifier = Rack::Lilypad.new(@app, '') do |app|
|
19
|
-
app.filters << %w(T1 T2)
|
20
|
-
app.log = 'T3'
|
21
|
-
end
|
22
|
-
notifier.filters.include?('T1').should == true
|
23
|
-
notifier.filters.include?('T2').should == true
|
24
|
-
notifier.log.should == 'T3'
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should write to a log file on success and failure" do
|
28
|
-
log = "#{SPEC}/fixtures/hoptoad.log"
|
29
|
-
notifier = Rack::Lilypad.new(@app, '') do |app|
|
30
|
-
app.log = log
|
31
|
-
end
|
32
|
-
|
33
|
-
notifier.call(@env) rescue nil
|
34
|
-
|
35
|
-
File.exists?(log).should == true
|
36
|
-
File.read(log).should =~ /Hoptoad Success/
|
37
|
-
File.delete(log)
|
38
|
-
|
39
|
-
@http.stub!(:post).and_return false
|
40
|
-
notifier.call(@env) rescue nil
|
41
|
-
|
42
|
-
File.exists?(log).should == true
|
43
|
-
File.read(log).should =~ /Hoptoad Failure/
|
44
|
-
File.delete(log)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should transfer valid XML to Hoptoad" do
|
48
|
-
# Test complex environment variables
|
49
|
-
@env['rack.hash_test'] = { :test => true }
|
50
|
-
@env['rack.object_test'] = Object.new
|
51
|
-
|
52
|
-
notifier = Rack::Lilypad.new(@app, '')
|
53
|
-
notifier.call(@env) rescue nil
|
54
|
-
validate_xml
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should allow direct access to the post method" do
|
58
|
-
@http.should_receive(:post)
|
59
|
-
begin
|
60
|
-
raise TestError, 'Test'
|
61
|
-
rescue Exception => e
|
62
|
-
Rack::Lilypad.notify(e)
|
63
|
-
end
|
64
|
-
validate_xml
|
65
|
-
end
|
66
|
-
|
67
|
-
describe 'Rails' do
|
68
|
-
|
69
|
-
def app
|
70
|
-
ActionController::Dispatcher.new
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should set ENV['RACK_ENV']" do
|
74
|
-
ENV['RACK_ENV'].should == 'production'
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should post an error to Hoptoad" do
|
78
|
-
@http.should_receive(:post)
|
79
|
-
get "/test" rescue nil
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should re-raise the exception (with ActionController::Failsafe disabled)" do
|
83
|
-
lambda { get "/test" }.should raise_error(TestError)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should catch middleware exceptions" do
|
87
|
-
@http.should_receive(:post)
|
88
|
-
get "/nothing?test_exception=1" rescue nil
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should not do anything if non-production environment" do
|
92
|
-
ENV['RACK_ENV'] = 'development'
|
93
|
-
@http.should_not_receive(:post)
|
94
|
-
get "/test" rescue nil
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe 'Sinatra' do
|
99
|
-
|
100
|
-
def app
|
101
|
-
SinatraApp.new
|
102
|
-
end
|
103
|
-
|
104
|
-
before(:each) do
|
105
|
-
ENV['RACK_ENV'] = 'production'
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should post an error to Hoptoad" do
|
109
|
-
@http.should_receive(:post)
|
110
|
-
get "/test" rescue nil
|
111
|
-
end
|
112
|
-
|
113
|
-
it "should re-raise the exception" do
|
114
|
-
lambda { get "/test" }.should raise_error(TestError)
|
115
|
-
end
|
116
|
-
|
117
|
-
it "should catch middleware exceptions" do
|
118
|
-
@http.should_receive(:post)
|
119
|
-
get "/nothing?test_exception=1" rescue nil
|
120
|
-
end
|
121
|
-
|
122
|
-
it "should not do anything if non-production environment" do
|
123
|
-
ENV['RACK_ENV'] = 'development'
|
124
|
-
@http.should_not_receive(:post)
|
125
|
-
get "/test" rescue nil
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|