From b2ed12c0d272f54d2de1e6b2dfccbc3b54ca98da Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Fri, 5 Jun 2009 22:34:03 -0700 Subject: [PATCH] Disable :show_exceptions on Base in all environments See http://tinyurl.com/l7lvnl for ML discussion on this. --- lib/sinatra/base.rb | 3 ++- test/options_test.rb | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 80e06c52..f67c9e79 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -941,7 +941,7 @@ module Sinatra set :raise_errors, true set :dump_errors, false set :clean_trace, true - set :show_exceptions, Proc.new { development? } + set :show_exceptions, false set :sessions, false set :logging, false set :methodoverride, false @@ -1012,6 +1012,7 @@ module Sinatra # Base class for classic style (top-level) applications. class Default < Base set :raise_errors, Proc.new { test? } + set :show_exceptions, Proc.new { development? } set :dump_errors, true set :sessions, false set :logging, Proc.new { ! test? } diff --git a/test/options_test.rb b/test/options_test.rb index df4de9f3..19f5ea2d 100644 --- a/test/options_test.rb +++ b/test/options_test.rb @@ -183,10 +183,15 @@ class OptionsTest < Test::Unit::TestCase end describe 'show_exceptions' do + %w[development test production none].each do |environment| + it "is disabled on Base in #{environment} environments" do + @base.set(:environment, environment) + assert ! @base.show_exceptions? + end + end + it 'is enabled on Default only in development' do @base.set(:environment, :development) - assert @base.show_exceptions? - assert @default.development? assert @default.show_exceptions?