Permalink
Browse files

fixes issue #13

  • Loading branch information...
Kellen Presley
Kellen Presley committed Jul 14, 2010
1 parent b76dfe0 commit 4317a52e386571804a8dbd32f6fea1e3329eb45d
Showing with 15 additions and 1 deletion.
  1. +1 −1 picard/lib/picard/request_extensions.js
  2. +8 −0 sample_app/app.js
  3. +6 −0 sample_app/spec/app_spec.rb
@@ -43,7 +43,7 @@ var request_extensions = {
scope.headers.push([ 'Content-Type', scope.type || 'text/html' ])
scope.headers = locals._set_cookies.call(req, scope.headers)
- if ( scope.status == 500 )
+ if ( scope.status == 500 && !scope.template )
req.send_data(scope)
else
locals._build_document.call(req, scope)
View
@@ -169,6 +169,14 @@ get('/foo/bar/*:baz', function(params) {
return {text: "Globbed params for 'baz': " + params.baz}
})
+get('/status/500', function(env){
+ env.on_screen({ // render a template
+ status: 500,
+ template: 'advanced',
+ commands: commands
+ })
+})
+
// controllers are groups of routes nested under a "route_set"
require('./controllers/ops_controller')
require('./controllers/test_controller')
@@ -297,4 +297,10 @@
res = Curl::Easy.perform(base_url + '/anonymous_fail_route')
res.body_str.should include("foo is not defined")
end
+
+ it 'should allow template rendering if the status is 500' do
+ res = Curl::Easy.perform(base_url + '/status/500')
+ res.body_str.should include('is even')
+ res.header_str.should include('500')
+ end
end

0 comments on commit 4317a52

Please sign in to comment.