Stop disabling sessions in test environement

Manually `disable :sessions` if you want to manually pass in
the `rack.session` env key in your tests.
This commit is contained in:
Simon Rozet 2009-10-03 15:01:51 +02:00
parent c6ea22bb8f
commit 341e3369d1
2 changed files with 10 additions and 3 deletions

View File

@ -916,7 +916,7 @@ module Sinatra
# an instance of the class new was called on.
def new(*args, &bk)
builder = Rack::Builder.new
builder.use Rack::Session::Cookie if sessions? && !test?
builder.use Rack::Session::Cookie if sessions?
builder.use Rack::CommonLogger if logging?
builder.use Rack::MethodOverride if methodoverride?
builder.use ShowExceptions if show_exceptions?

View File

@ -188,15 +188,22 @@ class HelpersTest < Test::Unit::TestCase
it 'creates a new session when none provided' do
mock_app {
enable :sessions
get '/' do
assert session.empty?
session[:foo] = 'bar'
'Hi'
redirect '/hi'
end
get '/hi' do
"hi #{session[:foo]}"
end
}
get '/'
assert_equal 'Hi', body
follow_redirect!
assert_equal 'hi bar', body
end
end