test/support/routes.rb in deas-0.42.0 vs test/support/routes.rb in deas-0.43.0
- old
+ new
@@ -6,17 +6,15 @@
root TEST_SUPPORT_ROOT
logger TEST_LOGGER
verbose_logging Factory.boolean
- set :a_setting, 'something'
-
error do |exception, context|
case exception
when Deas::NotFound
[404, "Couldn't be found"]
- when Exception
+ when *Deas::SinatraApp::STANDARD_ERROR_CLASSES
[500, "Oops, something went wrong"]
end
end
router do
@@ -44,10 +42,14 @@
redirect '/route_redirect', '/somewhere'
redirect('/:prefix/redirect'){ "/#{params['prefix']}/somewhere" }
end
+ use Rack::Session::Cookie, :key => 'my.session',
+ :expire_after => Factory.integer,
+ :secret => Factory.string
+
end
class DeasDevServer
include Deas::Server
@@ -151,11 +153,11 @@
class ErrorHandler
include Deas::ViewHandler
def run!
- raise 'test'
+ raise Deas::SinatraApp::STANDARD_ERROR_CLASSES.sample, 'sinatra app standard error'
end
end
class RedirectHandler
@@ -169,21 +171,21 @@
class SetSessionHandler
include Deas::ViewHandler
def run!
- session[:secret] = 'session_secret'
+ request.session[:secret] = 'session_secret'
redirect '/session'
end
end
class UseSessionHandler
include Deas::ViewHandler
def run!
- body session[:secret]
+ body request.session[:secret]
end
end
class HandlerTestsHandler
@@ -192,10 +194,9 @@
def init!
@data = {}
set_data('logger_class_name'){ logger.class.name }
set_data('request_method'){ request.request_method.to_s }
set_data('params_a_param'){ params['a-param'] }
- set_data('session_inspect'){ session.inspect }
end
def set_data(a, &block)
begin
@data[a] = block.call